Exemplo n.º 1
0
        public static string SaveEmploee(string account, string depcode, string depname, string duty,
                                         string eaddress, string eage, string eemail, string egradute, string eid, string elogin, string ename, string eno,
                                         string epwd, string esex, string esfz, string estate, string etelephone, string eworkdate, string role)
        {
            string              r    = "";
            Sys_Employee        se   = new Sys_Employee();
            Sys_User            su   = new Sys_User();
            Sys_EmployeeDpt     sed  = new Sys_EmployeeDpt();
            Sys_EmployeeBll     seb  = new Sys_EmployeeBll();
            Sys_UserBll         sub  = new Sys_UserBll();
            Sys_Employee        cse  = new Sys_Employee();
            Sys_DepmentBll      sdb  = new Sys_DepmentBll();
            Sys_EmployeeDptBll  sedb = new Sys_EmployeeDptBll();
            SessionUserValidate iv   = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                Sys_Depment sd = sdb.Query(" and dcode='" + depcode.Substring(0, 8) + "'");
                se.dname  = depname;
                se.dcode  = depcode;
                se.eno    = eno;
                se.ename  = ename;
                se.estate = estate == "1"?true:false;
                se.dtcode = "";
                se.elogin = elogin == "1" ? true : false;
                se.ecdate = DateTime.Now.ToString();
                se.emaker = iv.u.ename;
                se.rcode  = role;

                sed.eaddress     = eaddress;
                sed.eage         = Convert.ToInt32(eage);
                sed.eeducation   = egradute;
                sed.eemail       = eemail;
                sed.eheadimage   = "";
                sed.eidentity    = esfz;
                sed.enativeplace = "";
                sed.eno          = eno;
                sed.esex         = esex == "1" ? true : false;
                sed.etelephone   = etelephone;
                sed.eworkdate    = eworkdate;

                su.eno   = eno;
                su.upass = DES.EncryptDES(epwd);
                if (sd.dabc != "")
                {
                    su.uname = sd.dabc + "_" + account;
                }
                else
                {
                    su.uname = account;
                }
                su.ulogin     = elogin == "1"?true:false;
                su.uip        = "";
                su.ulogintime = "";
                if (eid == "0")
                {
                    if (!seb.Exists(" and eno='" + eno + "'"))
                    {
                        if (!sub.Exists(" and uname='" + su.uname + "'"))
                        {
                            if (seb.AddList(se, sed, su) > 0)
                            {
                                r = "S";
                            }
                            else
                            {
                                r = "F";
                            }
                        }
                        else
                        {
                            r = "TA";
                        }
                    }
                    else
                    {
                        r = "T";
                    }
                }
                else
                {
                    if (!seb.Exists(" and eno='" + eno + "' and id<>" + eid + ""))
                    {
                        if (!sub.Exists(" and uname='" + su.uname + "' and eno<>'" + eno + "'"))
                        {
                            cse = seb.Query(" and id=" + eid + "");
                            if (cse != null)
                            {
                                if (seb.UpdateList(cse.eno, se, sed, su) > 0)
                                {
                                    r = "S";
                                }
                                else
                                {
                                    r = "F";
                                }
                            }
                            else
                            {
                                r = "F";
                            }
                        }
                        else
                        {
                            r = "TA";
                        }
                    }
                    else
                    {
                        r = "T";
                    }
                }
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }
Exemplo n.º 2
0
        public static string AddCompany(string aid, string dabc, string daddress, string dcode, string dname, string dtype, string iadmin, string idep, string iproduction, string manager, string telephone)
        {
            string              r    = "";
            Sys_Depment         sd   = new Sys_Depment();
            Sys_DepmentDpt      sdd  = new Sys_DepmentDpt();
            Sys_DepmentBll      sdb  = new Sys_DepmentBll();
            Sys_DepmentDptBll   sddb = new Sys_DepmentDptBll();
            SessionUserValidate iv   = SysValidateBll.ValidateSession();

            if (iv.f)
            {
                sd.dname        = dname;
                sd.dcode        = dcode;
                sd.disend       = true;
                sd.disused      = true;
                sd.dattr        = dtype;
                sd.dcdate       = DateTime.Now.ToString();
                sd.dmaker       = iv.u.ename;
                sd.dpcode       = "0001";
                sd.dpname       = "北京联汇软件";
                sd.dcdep        = idep;
                sd.dread        = true;
                sd.dabc         = dabc;
                sdd.dcode       = dcode;
                sdd.daddress    = daddress;
                sdd.dcontact    = telephone;
                sdd.ddetail     = "";
                sdd.dfitment    = DateTime.Now.ToString();
                sdd.dmaker      = iv.u.ename;
                sdd.dmanager    = manager;
                sdd.dno         = "";
                sdd.iadmin      = iadmin == "1" ? true : false;
                sdd.idepment    = idep;
                sdd.logo        = "";
                sdd.iproduction = iproduction == "1" ? true : false;
                sdd.dperson     = 0;
                if (aid == "0")
                {
                    if (sdb.AddDepWithChildDep(sd) > 0)
                    {
                        if (sdd.iadmin)
                        {
                            #region
                            Sys_Employee       se   = new Sys_Employee();
                            Sys_User           su   = new Sys_User();
                            Sys_EmployeeDpt    sed  = new Sys_EmployeeDpt();
                            Sys_EmployeeBll    seb  = new Sys_EmployeeBll();
                            Sys_UserBll        sub  = new Sys_UserBll();
                            Sys_Employee       cse  = new Sys_Employee();
                            Sys_EmployeeDptBll sedb = new Sys_EmployeeDptBll();

                            se.dname  = sd.dname;
                            se.dcode  = sd.dcode;
                            se.eno    = "E" + seb.GetEno().ToString().PadLeft(8, '0');
                            se.ename  = sd.dname + "管理员";
                            se.estate = true;
                            se.dtcode = "";
                            se.elogin = true;
                            se.ecdate = DateTime.Now.ToString();
                            se.emaker = iv.u.ename;
                            se.rcode  = "0001";

                            sed.eaddress     = "";
                            sed.eage         = 0;
                            sed.eeducation   = "";
                            sed.eemail       = "";
                            sed.eheadimage   = "";
                            sed.eidentity    = "";
                            sed.enativeplace = "";
                            sed.eno          = se.eno;
                            sed.esex         = true;
                            sed.etelephone   = "";
                            sed.eworkdate    = DateTime.Now.ToString();

                            su.eno        = se.eno;
                            su.upass      = DES.EncryptDES("123456");
                            su.uname      = sd.dabc + "_admin";
                            su.ulogin     = true;
                            su.uip        = "";
                            su.ulogintime = "";
                            seb.AddList(se, sed, su);
                            #endregion
                        }
                        if (sdd.iproduction)
                        {
                            #region
                            Sys_InventoryCategoryBll sicb = new Sys_InventoryCategoryBll();
                            Sys_InventoryCategory    zcp  = new Sys_InventoryCategory();
                            zcp.iccode  = sd.dcode;
                            zcp.icpcode = "";
                            zcp.icname  = sd.dname + "产品";
                            zcp.icpname = "";
                            zcp.maker   = iv.u.ename;
                            zcp.cdate   = DateTime.Now.ToString();
                            zcp.icsend  = true;
                            zcp.icstate = false;
                            zcp.icms    = "";
                            sicb.Add(zcp);
                            Sys_InventoryCategory ztm = new Sys_InventoryCategory();
                            ztm.iccode  = sd.dcode + "10";
                            ztm.icpcode = sd.dcode;
                            ztm.icname  = "整套门";
                            ztm.icpname = "";
                            ztm.maker   = iv.u.ename;
                            ztm.cdate   = DateTime.Now.ToString();
                            ztm.icsend  = true;
                            ztm.icstate = true;
                            ztm.icms    = "";
                            ztm.isort   = 1;
                            sicb.Add(ztm);
                            Sys_InventoryCategory ms = new Sys_InventoryCategory();
                            ms.iccode  = sd.dcode + "01";
                            ms.icpcode = sd.dcode;
                            ms.icname  = "门扇";
                            ms.icpname = "";
                            ms.maker   = iv.u.ename;
                            ms.cdate   = DateTime.Now.ToString();
                            ms.icsend  = true;
                            ms.icstate = false;
                            ms.icms    = "";
                            ms.isort   = 2;
                            sicb.Add(ms);
                            Sys_InventoryCategory dms = new Sys_InventoryCategory();
                            dms.iccode  = ms.iccode + "01";
                            dms.icpcode = ms.iccode;
                            dms.icname  = "单开门";
                            dms.icpname = "门扇";
                            dms.maker   = iv.u.ename;
                            dms.cdate   = DateTime.Now.ToString();
                            dms.icsend  = true;
                            dms.icstate = true;
                            dms.icms    = "";
                            dms.isort   = 21;
                            sicb.Add(dms);
                            Sys_InventoryCategory sms = new Sys_InventoryCategory();
                            sms.iccode  = ms.iccode + "02";
                            sms.icpcode = ms.iccode;
                            sms.icname  = "对开门";
                            sms.icpname = "门扇";
                            sms.maker   = iv.u.ename;
                            sms.cdate   = DateTime.Now.ToString();
                            sms.icsend  = true;
                            sms.icstate = true;
                            sms.icms    = "";
                            sms.isort   = 22;
                            sicb.Add(sms);
                            Sys_InventoryCategory zms = new Sys_InventoryCategory();
                            zms.iccode  = ms.iccode + "03";
                            zms.icpcode = ms.iccode;
                            zms.icname  = "子母门";
                            zms.icpname = "门扇";
                            zms.maker   = iv.u.ename;
                            zms.cdate   = DateTime.Now.ToString();
                            zms.icsend  = true;
                            zms.icstate = true;
                            zms.icms    = "";
                            zms.isort   = 23;
                            sicb.Add(zms);
                            Sys_InventoryCategory tlm = new Sys_InventoryCategory();
                            tlm.iccode  = ms.iccode + "04";
                            tlm.icpcode = ms.iccode;
                            tlm.icname  = "推拉门";
                            tlm.icpname = "门扇";
                            tlm.maker   = iv.u.ename;
                            tlm.cdate   = DateTime.Now.ToString();
                            tlm.icsend  = true;
                            tlm.icstate = false;
                            tlm.icms    = "";
                            tlm.isort   = 24;
                            sicb.Add(tlm);
                            Sys_InventoryCategory stlm = new Sys_InventoryCategory();
                            stlm.iccode  = tlm.iccode + "01";
                            stlm.icpcode = tlm.iccode;
                            stlm.icname  = "两扇推拉门";
                            stlm.icpname = "推拉门";
                            stlm.maker   = iv.u.ename;
                            stlm.cdate   = DateTime.Now.ToString();
                            stlm.icsend  = true;
                            stlm.icstate = true;
                            stlm.icms    = "";
                            stlm.isort   = 241;
                            sicb.Add(stlm);
                            Sys_InventoryCategory ftlm = new Sys_InventoryCategory();
                            ftlm.iccode  = tlm.iccode + "02";
                            ftlm.icpcode = tlm.iccode;
                            ftlm.icname  = "四扇推拉门";
                            ftlm.icpname = "推拉门";
                            ftlm.maker   = iv.u.ename;
                            ftlm.cdate   = DateTime.Now.ToString();
                            ftlm.icsend  = true;
                            ftlm.icstate = true;
                            ftlm.icms    = "";
                            ftlm.isort   = 242;
                            sicb.Add(ftlm);
                            Sys_InventoryCategory mt = new Sys_InventoryCategory();
                            mt.iccode  = sd.dcode + "02";
                            mt.icpcode = sd.dcode;
                            mt.icname  = "门套";
                            mt.icpname = "";
                            mt.maker   = iv.u.ename;
                            mt.cdate   = DateTime.Now.ToString();
                            mt.icsend  = true;
                            mt.icstate = false;
                            mt.icms    = "";
                            mt.isort   = 3;
                            sicb.Add(mt);
                            Sys_InventoryCategory dmt = new Sys_InventoryCategory();
                            dmt.iccode  = mt.iccode + "01";
                            dmt.icpcode = mt.iccode;
                            dmt.icname  = "单开门套";
                            dmt.icpname = "门套";
                            dmt.maker   = iv.u.ename;
                            dmt.cdate   = DateTime.Now.ToString();
                            dmt.icsend  = true;
                            dmt.icstate = true;
                            dmt.icms    = "";
                            dmt.isort   = 31;
                            sicb.Add(dmt);
                            Sys_InventoryCategory smt = new Sys_InventoryCategory();
                            smt.iccode  = mt.iccode + "02";
                            smt.icpcode = mt.iccode;
                            smt.icname  = "对开门套";
                            smt.icpname = "门套";
                            smt.maker   = iv.u.ename;
                            smt.cdate   = DateTime.Now.ToString();
                            smt.icsend  = true;
                            smt.icstate = true;
                            smt.icms    = "";
                            smt.isort   = 32;
                            sicb.Add(smt);
                            Sys_InventoryCategory zmt = new Sys_InventoryCategory();
                            zmt.iccode  = mt.iccode + "03";
                            zmt.icpcode = mt.iccode;
                            zmt.icname  = "子母门套";
                            zmt.icpname = "门套";
                            zmt.maker   = iv.u.ename;
                            zmt.cdate   = DateTime.Now.ToString();
                            zmt.icsend  = true;
                            zmt.icstate = true;
                            zmt.icms    = "";
                            zmt.isort   = 33;
                            sicb.Add(zmt);
                            Sys_InventoryCategory tmt = new Sys_InventoryCategory();
                            tmt.iccode  = mt.iccode + "04";
                            tmt.icpcode = mt.iccode;
                            tmt.icname  = "推拉门套";
                            tmt.icpname = "门套";
                            tmt.maker   = iv.u.ename;
                            tmt.cdate   = DateTime.Now.ToString();
                            tmt.icsend  = true;
                            tmt.icstate = true;
                            tmt.icms    = "";
                            tmt.isort   = 34;
                            sicb.Add(tmt);
                            Sys_InventoryCategory wj = new Sys_InventoryCategory();
                            wj.iccode  = sd.dcode + "04";
                            wj.icpcode = sd.dcode;
                            wj.icname  = "五金";
                            wj.icpname = "";
                            wj.maker   = iv.u.ename;
                            wj.cdate   = DateTime.Now.ToString();
                            wj.icsend  = true;
                            wj.icstate = true;
                            wj.icms    = "";
                            wj.isort   = 4;
                            sicb.Add(wj);
                            Sys_InventoryCategory bl = new Sys_InventoryCategory();
                            bl.iccode  = sd.dcode + "05";
                            bl.icpcode = sd.dcode;
                            bl.icname  = "玻璃";
                            bl.icpname = "";
                            bl.maker   = iv.u.ename;
                            bl.cdate   = DateTime.Now.ToString();
                            bl.icsend  = true;
                            bl.icstate = true;
                            bl.icms    = "";
                            bl.isort   = 5;
                            sicb.Add(bl);
                            Sys_InventoryCategory ct = new Sys_InventoryCategory();
                            ct.iccode  = sd.dcode + "06";
                            ct.icpcode = sd.dcode;
                            ct.icname  = "窗套";
                            ct.icpname = "";
                            ct.maker   = iv.u.ename;
                            ct.cdate   = DateTime.Now.ToString();
                            ct.icsend  = true;
                            ct.icstate = true;
                            ct.icms    = "";
                            ct.isort   = 6;
                            sicb.Add(ct);
                            Sys_InventoryCategory yk = new Sys_InventoryCategory();
                            yk.iccode  = sd.dcode + "07";
                            yk.icpcode = sd.dcode;
                            yk.icname  = "垭口";
                            yk.icpname = "";
                            yk.maker   = iv.u.ename;
                            yk.cdate   = DateTime.Now.ToString();
                            yk.icsend  = true;
                            yk.icstate = true;
                            yk.icms    = "";
                            yk.isort   = 7;
                            sicb.Add(yk);
                            Sys_InventoryCategory hj = new Sys_InventoryCategory();
                            hj.iccode  = sd.dcode + "08";
                            hj.icpcode = sd.dcode;
                            hj.icname  = "护角";
                            hj.icpname = "";
                            hj.maker   = iv.u.ename;
                            hj.cdate   = DateTime.Now.ToString();
                            hj.icsend  = true;
                            hj.icstate = true;
                            hj.icms    = "";
                            hj.isort   = 8;
                            sicb.Add(hj);
                            Sys_InventoryCategory qt = new Sys_InventoryCategory();
                            qt.iccode  = sd.dcode + "09";
                            qt.icpcode = sd.dcode;
                            qt.icname  = "其他";
                            qt.icpname = "";
                            qt.maker   = iv.u.ename;
                            qt.cdate   = DateTime.Now.ToString();
                            qt.icsend  = true;
                            qt.icstate = true;
                            qt.icms    = "";
                            qt.isort   = 9;
                            sicb.Add(qt);
                            #endregion
                        }
                        sddb.Add(sdd);
                        r = "S";
                    }
                    else
                    {
                        r = "F";
                    }
                }
                else
                {
                    if (sdb.Update(sd))
                    {
                        sddb.Update(sdd);
                        r = "S";
                    }
                    else
                    {
                        r = "F";
                    }
                }
            }
            else
            {
                r = iv.badstr;
            }
            return(r);
        }