A-A+

物业客户管理信息系统(七)之员工主窗体~3

2015年05月02日 日志 暂无评论 阅读 248 次

第三部分的主界面代码,具体是什么功能的我说不清啊,反正整个窗体的功能有房产信息管理模块,包括添加开发商,添加楼盘,添加详细的楼盘内的房间信息;员工管理功能模块,可以设置添加员工,审核员工,以及提升降低员工权限,删除员工等等的;业主管理功能模块,主要功能是添加业主,删除业主,修改业主和审核业主等操作;最后一个是服务管理功能模块,包括各种物业公司日常管理业务记录子模块、业主申请请求服务子模块等等三大子模块功能。整个主界面就包含了这四个大的功能模块,基本上可以满足企业需求,但是事实上,系统设计初期的需求分析等都是个人凭空“意淫”出来的,所以,要真正的用到企业中的话还是不靠谱的。呵呵,毕竟是两个星期做出来的。

下图是物业管理信息系统的主界面的背景设计图。图片是网上早来的,然后一分为二,用来做了我的主界面了,感觉很好看啊。
物业客户管理信息系统(七)之员工主窗体~3

  1. private void 删除部门toolStripMenuItem_Click(object sender, EventArgs e)  
  2. {  
  3.     if (DialogResult.OK == MessageBox.Show("确定删除(" + treeview_left.SelectedNode.Text + ")的所有信息吗?""询问", MessageBoxButtons.OKCancel, MessageBoxIcon.Question))  
  4.     {  
  5.         DataSet gwDSet = SQLClass.getDataSet("select id from gangwei where bumen = '" + treeview_left.SelectedNode.Text + "'""岗位信息表");  
  6.         DataTable gwdt = gwDSet.Tables["岗位信息表"];  
  7.         if(gwdt.Rows.Count > 0)  
  8.         {  
  9.             for (int i = 0; i < gwdt.Rows.Count; i++)  
  10.             {  
  11.                 DataSet DSet = SQLClass.getDataSet("select id from yuangong where gangweiid = '" + gwdt.Rows[i][0].ToString() + "'""员工信息表");  
  12.                 DataTable dt = DSet.Tables["员工信息表"];  
  13.                 if (dt.Rows.Count > 0)  
  14.                 {  
  15.                     MessageBox.Show("该节点中有员工,不能删除(" + treeview_left.SelectedNode.Text + ")的所有信息。""信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);  
  16.                     return;  
  17.                 }  
  18.                 else  
  19.                 {  
  20.   
  21.                 }  
  22.             }  
  23.         }  
  24.         else  
  25.         {  
  26.   
  27.         }  
  28.         //确认删除数据  
  29.         SQLClass.getsqlcom("delete from gangwei where bumen = '" + treeview_left.SelectedNode.Text + "'");  
  30.         UpdateTreeview();  
  31.         SQLClass.con_close();       //关闭数据库连接,释放资源  
  32.         MessageBox.Show("删除岗位成功!""信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);  
  33.     }  
  34. }  
  35.   
  36. private void 删除岗位toolStripMenuItem_Click(object sender, EventArgs e)  
  37. {  
  38.     if (DialogResult.OK == MessageBox.Show("确定删除(" + treeview_left.SelectedNode.Text + ")的所有信息吗?""询问", MessageBoxButtons.OKCancel, MessageBoxIcon.Question))  
  39.     {  
  40.         DataSet DSet = SQLClass.getDataSet("select id from yuangong where gangweiid = '" + treeview_left.SelectedNode.Name + "'""员工信息表");  
  41.         DataTable dt = DSet.Tables["员工信息表"];  
  42.         if (dt.Rows.Count > 0)  
  43.         {  
  44.             MessageBox.Show("该节点中有员工,不能删除(" + treeview_left.SelectedNode.Text + ")的所有信息。""信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);  
  45.             return;  
  46.         }  
  47.         else  
  48.         {  
  49.             //确认删除数据  
  50.             SQLClass.getsqlcom("delete from gangwei where id = '" + treeview_left.SelectedNode.Name + "' and gangwei = '" + treeview_left.SelectedNode.Text + "'");  
  51.             UpdateTreeview();  
  52.             SQLClass.con_close();       //关闭数据库连接,释放资源  
  53.             MessageBox.Show("删除岗位成功!""信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);  
  54.         }  
  55.     }  
  56. }  
  57. private void 刷新树toolStripMenuItem_Click(object sender, EventArgs e)  
  58. {  
  59.     UpdateTreeview();  
  60.     treeview_left_AfterSelect(sender, e);  
  61. }  
  62. private void 刷新列toolStripMenuItem_Click(object sender, EventArgs e)  
  63. {  
  64.     treeview_left_AfterSelect(sender, e);  
  65. }  
  66.   
  67. private void listview_right_MouseDown(object sender, MouseEventArgs e)  
  68. {  
  69.     this.listview_right.ContextMenuStrip = conMenuStr_list_1;  
  70.     conMenuStr_list_1.Items.Clear();  
  71.     switch (splitcon1.Tag.ToString())  
  72.     {  
  73.         case "sy":  
  74.             ToolStripMenuItem addzhufang = new ToolStripMenuItem("添加住房");  
  75.             addzhufang.Click += new EventHandler(添加住房toolStripMenuItem_Click);  
  76.             conMenuStr_list_1.Items.Add(addzhufang);  
  77.             break;  
  78.         case "yz":  
  79.             ToolStripMenuItem addyezhu = new ToolStripMenuItem("添加业主");  
  80.             addyezhu.Click += new EventHandler(添加业主toolStripMenuItem_Click);  
  81.             conMenuStr_list_1.Items.Add(addyezhu);  
  82.             break;  
  83.         case "yg":  
  84.             ToolStripMenuItem addyuangong = new ToolStripMenuItem("添加员工");  
  85.             addyuangong.Click += new EventHandler(添加员工toolStripMenuItem_Click);  
  86.             conMenuStr_list_1.Items.Add(addyuangong);  
  87.             break;  
  88.         case "yw":  
  89.             if (treeview_left.SelectedNode == null)      //判断是否选中了树节点  
  90.             {  
  91.                 return;  
  92.             }  
  93.             switch (treeview_left.SelectedNode.Name)  
  94.             {  
  95.                 case "1":  
  96.                     ToolStripMenuItem addrichang = new ToolStripMenuItem("添加日常");  
  97.                     addrichang.Click += new EventHandler(添加日常toolStripMenuItem_Click);  
  98.                     conMenuStr_list_1.Items.Add(addrichang);  
  99.                     break;  
  100.                 case "2":  
  101.                     ToolStripMenuItem addshenqing = new ToolStripMenuItem("添加申请");  
  102.                     addshenqing.Click += new EventHandler(添加申请toolStripMenuItem_Click);  
  103.                     conMenuStr_list_1.Items.Add(addshenqing);  
  104.                     break;  
  105.                 case "3":  
  106.                     ToolStripMenuItem addshoufei = new ToolStripMenuItem("添加收费");  
  107.                     addshoufei.Click += new EventHandler(添加收费toolStripMenuItem_Click);  
  108.                     conMenuStr_list_1.Items.Add(addshoufei);  
  109.                     break;  
  110.             }  
  111.             break;  
  112.     }  
  113.     if (listview_right.SelectedItems.Count <= 0 || listview_right.SelectedItems[0].SubItems[1].Text == "")  
  114.     {  
  115.   
  116.     }  
  117.     else  
  118.     {  
  119.         switch (splitcon1.Tag.ToString())  
  120.         {  
  121.             case "sy":  
  122.                 ToolStripMenuItem revisezhufang = new ToolStripMenuItem("修改住房");  
  123.                 ToolStripMenuItem deletezhufang = new ToolStripMenuItem("删除住房");  
  124.                 ToolStripMenuItem inzhufang = new ToolStripMenuItem("业主入住");  
  125.                 ToolStripMenuItem outzhufang = new ToolStripMenuItem("业主迁出");  
  126.                 ToolStripMenuItem rezhufang = new ToolStripMenuItem("退款迁出");  
  127.                 revisezhufang.Click += new EventHandler(修改住房toolStripMenuItem_Click);  
  128.                 deletezhufang.Click += new EventHandler(删除住房toolStripMenuItem_Click);  
  129.                 inzhufang.Click += new EventHandler(业主入住toolStripMenuItem_Click);  
  130.                 outzhufang.Click += new EventHandler(业主迁出toolStripMenuItem_Click);  
  131.                 rezhufang.Click += new EventHandler(退款迁出toolStripMenuItem_Click);  
  132.                 conMenuStr_list_1.Items.Add(revisezhufang);  
  133.                 conMenuStr_list_1.Items.Add(deletezhufang);  
  134.                 conMenuStr_list_1.Items.Add(inzhufang);  
  135.                 conMenuStr_list_1.Items.Add(outzhufang);  
  136.                 conMenuStr_list_1.Items.Add(rezhufang);  
  137.                 break;  
  138.             case "yz":  
  139.                 ToolStripMenuItem reviseyezhu = new ToolStripMenuItem("修改业主");  
  140.                 ToolStripMenuItem deleteyezhu = new ToolStripMenuItem("删除业主");  
  141.                 ToolStripMenuItem passyezhu = new ToolStripMenuItem("审核通过");  
  142.                 ToolStripMenuItem cancelyezhu = new ToolStripMenuItem("取消审核");  
  143.                 reviseyezhu.Click += new EventHandler(修改业主toolStripMenuItem_Click);  
  144.                 deleteyezhu.Click += new EventHandler(删除业主toolStripMenuItem_Click);  
  145.                 passyezhu.Click += new EventHandler(审核通过toolStripMenuItem_Click);  
  146.                 cancelyezhu.Click += new EventHandler(取消审核toolStripMenuItem_Click);  
  147.                 conMenuStr_list_1.Items.Add(reviseyezhu);  
  148.                 conMenuStr_list_1.Items.Add(deleteyezhu);  
  149.                 conMenuStr_list_1.Items.Add(passyezhu);  
  150.                 conMenuStr_list_1.Items.Add(cancelyezhu);  
  151.                 ToolStripMenuItem addshoufei = new ToolStripMenuItem("添加收费");  
  152.                 addshoufei.Click += new EventHandler(添加收费toolStripMenuItem_Click);  
  153.                 conMenuStr_list_1.Items.Add(addshoufei);  
  154.                 break;  
  155.             case "yg":  
  156.                 ToolStripMenuItem reviseyuangong = new ToolStripMenuItem("修改员工");  
  157.                 ToolStripMenuItem deleteyuangong = new ToolStripMenuItem("删除员工");  
  158.                 reviseyuangong.Click += new EventHandler(修改员工toolStripMenuItem_Click);  
  159.                 deleteyuangong.Click += new EventHandler(删除员工toolStripMenuItem_Click);  
  160.                 conMenuStr_list_1.Items.Add(reviseyuangong);  
  161.                 conMenuStr_list_1.Items.Add(deleteyuangong);  
  162.                 if(glyqx == 2)  
  163.                 {  
  164.                     ToolStripMenuItem sheyuangong = new ToolStripMenuItem("设为管理员");  
  165.                     ToolStripMenuItem quyuangong = new ToolStripMenuItem("设为普通员工");  
  166.                     sheyuangong.Click += new EventHandler(设为管理员toolStripMenuItem_Click);  
  167.                     quyuangong.Click += new EventHandler(设为普通员工toolStripMenuItem_Click);  
  168.                     conMenuStr_list_1.Items.Add(sheyuangong);  
  169.                     conMenuStr_list_1.Items.Add(quyuangong);  
  170.                 }  
  171.                 break;  
  172.             case "yw":  
  173.                 if (treeview_left.SelectedNode == null)      //判断是否选中了树节点  
  174.                 {  
  175.                     return;  
  176.                 }  
  177.                 switch (treeview_left.SelectedNode.Name)  
  178.                 {  
  179.                     case "1":  
  180.                         ToolStripMenuItem reviserichang = new ToolStripMenuItem("修改日常");  
  181.                         ToolStripMenuItem deleterichang = new ToolStripMenuItem("删除日常");  
  182.                         ToolStripMenuItem overrichang = new ToolStripMenuItem("设为已完成");  
  183.                         ToolStripMenuItem cancelrichang = new ToolStripMenuItem("设为未完成");  
  184.                         reviserichang.Click += new EventHandler(修改日常toolStripMenuItem_Click);  
  185.                         deleterichang.Click += new EventHandler(删除日常toolStripMenuItem_Click);  
  186.                         overrichang.Click += new EventHandler(设为已完成toolStripMenuItem_Click);  
  187.                         cancelrichang.Click += new EventHandler(设为未完成toolStripMenuItem_Click);  
  188.                         conMenuStr_list_1.Items.Add(reviserichang);  
  189.                         conMenuStr_list_1.Items.Add(deleterichang);  
  190.                         conMenuStr_list_1.Items.Add(overrichang);  
  191.                         conMenuStr_list_1.Items.Add(cancelrichang);  
  192.                         break;  
  193.                     case "2":  
  194.                         ToolStripMenuItem reviseshenqing = new ToolStripMenuItem("修改申请");  
  195.                         ToolStripMenuItem deleteshenqing = new ToolStripMenuItem("删除申请");  
  196.                         ToolStripMenuItem acceptshenqing = new ToolStripMenuItem("受理申请");  
  197.                         ToolStripMenuItem cancelacceptshenqing = new ToolStripMenuItem("取消受理");  
  198.                         ToolStripMenuItem overshenqing = new ToolStripMenuItem("完成申请");  
  199.                         ToolStripMenuItem cancelovershenqing = new ToolStripMenuItem("取消完成");  
  200.                         reviseshenqing.Click += new EventHandler(修改申请toolStripMenuItem_Click);  
  201.                         deleteshenqing.Click += new EventHandler(删除申请toolStripMenuItem_Click);  
  202.                         acceptshenqing.Click += new EventHandler(受理申请toolStripMenuItem_Click);  
  203.                         cancelacceptshenqing.Click += new EventHandler(取消受理toolStripMenuItem_Click);  
  204.                         overshenqing.Click += new EventHandler(完成申请toolStripMenuItem_Click);  
  205.                         cancelovershenqing.Click += new EventHandler(取消完成toolStripMenuItem_Click);  
  206.                         conMenuStr_list_1.Items.Add(reviseshenqing);  
  207.                         conMenuStr_list_1.Items.Add(deleteshenqing);  
  208.                         conMenuStr_list_1.Items.Add(acceptshenqing);  
  209.                         conMenuStr_list_1.Items.Add(cancelacceptshenqing);  
  210.                         conMenuStr_list_1.Items.Add(overshenqing);  
  211.                         conMenuStr_list_1.Items.Add(cancelovershenqing);  
  212.                         break;  
  213.                     case "3":  
  214.                         ToolStripMenuItem reviseshoufei = new ToolStripMenuItem("修改收费");  
  215.                         ToolStripMenuItem deleteshoufei = new ToolStripMenuItem("删除收费常");  
  216.                         reviseshoufei.Click += new EventHandler(修改收费toolStripMenuItem_Click);  
  217.                         deleteshoufei.Click += new EventHandler(删除收费toolStripMenuItem_Click);  
  218.                         conMenuStr_list_1.Items.Add(reviseshoufei);  
  219.                         conMenuStr_list_1.Items.Add(deleteshoufei);  
  220.                         ToolStripMenuItem yishoufei = new ToolStripMenuItem("设为已缴费");  
  221.                         ToolStripMenuItem weishoufei = new ToolStripMenuItem("设为未缴费");  
  222.                         yishoufei.Click += new EventHandler(设为已缴费toolStripMenuItem_Click);  
  223.                         weishoufei.Click += new EventHandler(设为未缴费toolStripMenuItem_Click);  
  224.                         conMenuStr_list_1.Items.Add(yishoufei);  
  225.                         conMenuStr_list_1.Items.Add(weishoufei);  
  226.                         break;  
  227.                 }  
  228.                 break;  
  229.         }  
  230.     }  
  231.     ToolStripMenuItem daochuexcel = new ToolStripMenuItem("导出Excel");  
  232.     daochuexcel.Click += new EventHandler(导出ExceltoolStripMenuItem_Click);  
  233.     conMenuStr_list_1.Items.Add(daochuexcel);  
  234.     ToolStripMenuItem refresh = new ToolStripMenuItem("刷新");  
  235.     refresh.Click += new EventHandler(刷新列toolStripMenuItem_Click);  
  236.     conMenuStr_list_1.Items.Add(refresh);  
  237. }  
  238.   
  239. //listview列表右键菜单  
  240. private void 导出ExceltoolStripMenuItem_Click(object sender, EventArgs e)  
  241. {  
  242.     if(listview_right.Items.Count <= 0)  
  243.     {  
  244.         MessageBox.Show("列表为空,不能导出!""信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);  
  245.     }  
  246.     else  
  247.     {  
  248.         ExportToExecl();  
  249.     }  
  250. }  
  251. private void 添加住房toolStripMenuItem_Click(object sender, EventArgs e)  
  252. {  
  253.     SqlDataReader DR = SQLClass.getcom("select id from fangchan");  
  254.     bool ifcom = DR.Read();  
  255.     if(!ifcom)  
  256.     {  
  257.         MessageBox.Show("你还没有添加房产不能进行该操作!""信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);  
  258.         return;  
  259.     }  
  260.     Zhufang_Form zf = new Zhufang_Form();  
  261.     zf.Form_Type = 0;  
  262.     if(treeview_left.SelectedNode == null)  
  263.     {  
  264.         zf.fcname = null;  
  265.     }  
  266.     else  
  267.     {  
  268.         zf.fcname = treeview_left.SelectedNode.Text;  
  269.     }  
  270.     zf.Text = "添加住房";  
  271.     zf.ShowDialog();  
  272.     if (zf.Form_OK == 1)  
  273.     {  
  274.         treeview_left_AfterSelect(sender, e);  
  275.         //treeview_left_AfterSelect(sender, e);  
  276.         MessageBox.Show("添加住房成功!""信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);  
  277.     }  
  278. }  
  279. private void 修改住房toolStripMenuItem_Click(object sender, EventArgs e)  
  280. {  
  281.     if(listview_right.SelectedItems[0].SubItems[5].Text == "已入住")  
  282.     {  
  283.         if (DialogResult.OK == MessageBox.Show("住房处于入住状态,修改可能会出现错误,确定要继续吗?""询问", MessageBoxButtons.OKCancel, MessageBoxIcon.Question))  
  284.         {  
  285.   
  286.         }  
  287.         else  
  288.         {  
  289.             MessageBox.Show("操作已取消!""信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);  
  290.             return;  
  291.         }  
  292.     }  
  293.     else  
  294.     {  
  295.   
  296.     }  
  297.     Zhufang_Form zf = new Zhufang_Form();  
  298.     if (treeview_left.SelectedNode == null)  
  299.     {  
  300.         zf.fcname = null;  
  301.     }  
  302.     else  
  303.     {  
  304.         zf.fcname = treeview_left.SelectedNode.Text;  
  305.     }  
  306.     zf.zfid = listview_right.SelectedItems[0].SubItems[1].Text;  
  307.     zf.Form_Type = 1;  
  308.     zf.Text = "修改住房";  
  309.     zf.ShowDialog();  
  310.     if (zf.Form_OK == 1)  
  311.     {  
  312.         treeview_left_AfterSelect(sender, e);  
  313.         MessageBox.Show("修改住房成功!""信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);  
  314.     }  
  315. }  
  316. private void 删除住房toolStripMenuItem_Click(object sender, EventArgs e)  
  317. {  
  318.     if(listview_right.SelectedItems[0].SubItems[5].Text == "已入住")  
  319.     {  
  320.         MessageBox.Show("已有业主入住,无法删除!""信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);  
  321.     }  
  322.     else  
  323.     {  
  324.         if (DialogResult.OK == MessageBox.Show("确定删除(" + treeview_left.SelectedNode.Text + "的" + listview_right.SelectedItems[0].SubItems[1].Text + "号住房)的所有信息吗?""询问", MessageBoxButtons.OKCancel, MessageBoxIcon.Question))  
  325.         {  
  326.             //确认删除数据  
  327.             SQLClass.getsqlcom("delete from zhufang where id = '" + listview_right.SelectedItems[0].SubItems[1].Text + "'");  
  328.             treeview_left_AfterSelect(sender, e);  
  329.             SQLClass.con_close();       //关闭数据库连接,释放资源  
  330.             MessageBox.Show("删除住房成功!""信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);  
  331.         }  
  332.     }  
  333. }  
  334. private void 业主入住toolStripMenuItem_Click(object sender, EventArgs e)  
  335. {  
  336.     Zhufang_Form zf = new Zhufang_Form();  
  337.     if (treeview_left.SelectedNode == null)  
  338.     {  
  339.         zf.fcname = null;  
  340.     }  
  341.     else  
  342.     {  
  343.         zf.fcname = treeview_left.SelectedNode.Text;  
  344.     }  
  345.     if(listview_right.SelectedItems[0].SubItems[5].Text == "已入住")  
  346.     {  
  347.         MessageBox.Show("已有用户入住,未迁出之前不得再入住!""信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);  
  348.     }  
  349.     else  
  350.     {  
  351.         zf.zfid = listview_right.SelectedItems[0].SubItems[1].Text;  
  352.         zf.Form_Type = 3;  
  353.         zf.Text = "业主入住";  
  354.         zf.ShowDialog();  
  355.         if (zf.Form_OK == 1)  
  356.         {  
  357.             treeview_left_AfterSelect(sender, e);  
  358.             MessageBox.Show("设置入住成功!""信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);  
  359.         }  
  360.     }  
  361.   
  362.   
  363. }  
  364. private void 业主迁出toolStripMenuItem_Click(object sender, EventArgs e)  
  365. {  
  366.     if (listview_right.SelectedItems[0].SubItems[5].Text == "已入住")  
  367.     {  
  368.         if (DialogResult.OK == MessageBox.Show("确定设置(" + treeview_left.SelectedNode.Text + "的" + listview_right.SelectedItems[0].SubItems[1].Text + "号住房)的业主迁出吗?""询问", MessageBoxButtons.OKCancel, MessageBoxIcon.Question))  
  369.         {  
  370.             SQLClass.getsqlcom("update zhufang set yezhuid = '',zhuangtai = '0' where id = '" + listview_right.SelectedItems[0].SubItems[1].Text + "'");  
  371.             treeview_left_AfterSelect(sender, e);  
  372.             MessageBox.Show("设置迁出成功!""信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);  
  373.         }  
  374.     }  
  375.     else  
  376.     {  
  377.         MessageBox.Show("暂无用户入住,无需迁出!""信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);  
  378.     }  
  379. }  

给我留言



Copyright © Lee's Blog 保留所有权利.   Theme by Ality    粤ICP备17161478号-1

用户登录 ⁄ 注册

分享到: