Smobiler上海石磨_.NET移动开发平台
标题:
coms管理系统——由头、请假功能
[打印本页]
作者:
Lincy.Lin
时间:
2016-2-18 11:55
标题:
coms管理系统——由头、请假功能
2015年初,基于smobiler平台开发的coms管理系统上线了,这套系统主要是方便大家快速,便捷的报销的。在一年的使用中,大家对这套系统也越来越肯定了,在这一年中,大家提出了很多的新功能新要求。这不,2015年12月底,把这些建议通通收集起来,领导就和大家一起开会讨论,最后敲定了新加请假、签到、日志、周报等功能。
虽然2015年底就确定了新功能了,由于我在做其他项目,而这个项目的开发一直也是我来做的,所以只好等待其他项目做完,在来新加这些功能了。
等待等待......
2016年2月16号老大就要求完善coms管理系统的新功能了,于是重新把之前的功能要求研究下,现在就开始动手开发新功能了。首先就开始来做请假功能,做请假功能时候首先我考虑到了风格的统一问题,新加的功能一定要和以前的报销等功能一致,不然看上去会觉得很不舒服。
先来一张工具箱的截图。
[attach]488[/attach]
现在来做请假功能第一个界面,请假条创建。通过拖拉工具箱中的lable、textbox和button等控件,并分别对控件进行简单布局。一个请假条创建界面就设计好了。
[attach]487[/attach]
请假条创建界面的标题如何来设计的了,将窗体的TitleText属性赋值,在将窗体的TitleBackColor属性设置为DeepSkyBlue颜色
[attach]489[/attach]
接下来设计窗体保存按钮,这里我将保存和返回按钮设计在底部。
[attach]490[/attach]
现在就可以看到客户端的显示效果。
[attach]479[/attach]
作者:
Lincy.Lin
时间:
2016-2-18 15:22
请假的设计界面完成了,如何实现类别选择和审批人抄送人选择。
拖拉一个PopList控件。双击审批人按钮控件,进入事件,这里贴一张事件代码
//获取审批人或抄送人
private void BtnCUser_Click(object sender, EventArgs e)
{
//获取审批人或抄送人
btn = sender;
//获取数据
LeaveInfo Leave = new LeaveInfo();
DataTable table = Leave.GetConfirmUser();
PopList1.Groups.Clear();
PopListGroup poli = new PopListGroup();
PopList1.Groups.Add(poli);
switch (((Button)sender).Name)
{
case "BtnCUser":
case "BtnCUser2":
PopList1.MultiSelect = false;
poli.Text = "审批人";
break;
case "Btnccuser2":
case "Btnccuser1":
PopList1.MultiSelect = true;
poli.Text = "抄送人";
break;
}
//显示选择列表中key和values
foreach (DataRow rowli in table.Rows)
{
poli.Items.Add(rowli["USER_ID"].ToString(), rowli["USER_ID"].ToString());
switch (((Button)sender).Name)
{
case "BtnCUser":
case "BtnCUser2":
if (CUser.Trim().Length > 0)
{
if (CUser.Trim().ToUpper() == rowli["USER_ID"].ToString().Trim().ToUpper())
{
PopList1.SetSelections(poli.Items[(poli.Items.Count - 1)]);
}
}
break;
case "Btnccuser2":
case "Btnccuser1":
if (CCUser.Trim().Length > 0)
{
if (CCUser.Trim().ToUpper() == rowli["USER_ID"].ToString().Trim().ToUpper())
{
PopList1.SetSelections(poli.Items[(poli.Items.Count - 1)]);
}
}
break;
}
}
PopList1.Show();
}
复制代码
poplist选择后赋值代码
/// <summary>
/// PopList的审批人,抄送人赋值
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void PopList1_Selected(object sender, EventArgs e)
{
try
{
switch (((Button)btn).Name)
{
case "BtnCUser":
case "BtnCUser2":
if (PopList1.Selection != null)
{
CUser = PopList1.Selection.Value;
this.BtnCUser.Text = PopList1.Selection.Text.Trim();
}
break;
case "Btnccuser2":
case "Btnccuser1":
if (PopList1.Selections != null)
{
CCUser = "";
foreach (PopListItem poitem in PopList1.Selections)
{
if (CCUser.Length > 0)
{
CCUser += "," + poitem.Value;
}
else
{
CCUser = poitem.Value;
}
}
if (CCUser.Length > 0)
{
this.Btnccuser1.Text = CCUser;
}
}
break;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
复制代码
请假条创建界面的功能基本完成了,接下来就是对界面输入数据保存了。这里是通过ToolbarItemClick事件,具体代码如下:
/// <summary>
/// toolbar事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void frmLeaveCreate_ToolbarItemClick(object sender, ToolbarClickEventArgs e)
{
try
{
if (e.Name.Equals(tExit.Name))
{
MessageBox.Show("是否确定返回?", MessageBoxButtons.YesNo, (Object s, MessageBoxHandlerArgs args) =>
{
if (args.Result == Smobiler.Core.ShowResult.Yes)
{
this.Close();
}
}
);
}
else if (e.Name.Equals(save.Name))
{
if (LDAY.Text.Length < 0)
{
throw new Exception("请输入请假天数!");
}
if (int.Parse(LDAY.Text) <= 0)
{
throw new Exception("请假天数必须大于0!");
}
if (LREASON.Text.Length < 0)
{
throw new Exception("请输入请假事由!");
}
MessageBox.Show("请假条创建成功!", (Object s, MessageBoxHandlerArgs args) =>
{
ShowResult = Smobiler.Core.ShowResult.Yes;
});
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
复制代码
作者:
vicky
时间:
2016-2-18 16:16
赞!
作者:
Csharp
时间:
2016-2-27 11:05
请问一下,请问一下请假条创建,布局是用的什么控件。
作者:
Lincy.Lin
时间:
2016-2-29 10:31
Csharp 发表于 2016-2-27 11:05
请问一下,请问一下请假条创建,布局是用的什么控件。
请假条创建布局的控件有lable、Textbox、Button、DatePicker、Poplist、Camera和ImageButton
作者:
sxczzll
时间:
2016-7-5 10:05
支持一下
作者:
hxye
时间:
2021-2-13 22:19
我用了保存的图片 ios-save,运行出来是个钥匙形,怪不怪!
作者:
hxye
时间:
2021-2-13 22:49
这条语句e.Name.Equals(tExit.Name) tExit下有波浪线,显示上下文没有这个变量,是什么原因?
欢迎光临 Smobiler上海石磨_.NET移动开发平台 (https://www.smobiler.cn/)
Powered by Discuz! X3.2