Exemple #1
0
        public static bool CopyPt(List <string> lstSid, string _strZid, string _strDesZtId)
        {
            bool bRs = false;

            try
            {
                //MySqlDbAccess.ExecNoQuery(CommandType.Text, string.Format(strSqlTmp, _strSid, _strZid));

                using (MySqlDataContext db = new MySqlDataContext())
                {
                    foreach (string _strSid in lstSid)
                    {
                        DAL.ShowBase stbase = db.ShowBase.FirstOrDefault(x => x.SiD == _strSid && x.ZTID.Value.ToString() == _strZid);
                        if (stbase != null)
                        {
                            DAL.ShowBase tmp = Clone(stbase);
                            tmp.ZTID = int.Parse(_strDesZtId);
                            tmp.ID   = 0;
                            db.ShowBase.InsertOnSubmit(tmp);
                        }

                        DAL.STAnS stans = db.STAnS.FirstOrDefault(x => x.SiD == _strSid && x.ZTID.Value.ToString() == _strZid);
                        if (stans != null)
                        {
                            DAL.STAnS tmp = Clone(stans);
                            tmp.ZTID = int.Parse(_strDesZtId);
                            tmp.ID   = 0;
                            db.STAnS.InsertOnSubmit(tmp);
                        }

                        DAL.STCPc stcpc = db.STCPc.FirstOrDefault(x => x.SiD == _strSid && x.ZTID.Value.ToString() == _strZid);
                        if (stcpc != null)
                        {
                            DAL.STCPc tmp = Clone(stcpc);
                            tmp.ZTID = int.Parse(_strDesZtId);
                            tmp.ID   = 0;
                            db.STCPc.InsertOnSubmit(tmp);
                        }

                        DAL.STCt stct = db.STCt.FirstOrDefault(x => x.SiD == _strSid && x.ZTID.Value.ToString() == _strZid);
                        if (stct != null)
                        {
                            DAL.STCt tmp = Clone(stct);
                            tmp.ZTID = int.Parse(_strDesZtId);
                            tmp.ID   = 0;
                            db.STCt.InsertOnSubmit(tmp);
                        }

                        DAL.STDc stdc = db.STDc.FirstOrDefault(x => x.SiD == _strSid && x.ZTID.Value.ToString() == _strZid);
                        if (stdc != null)
                        {
                            DAL.STDc tmp = Clone(stdc);
                            tmp.ZTID = int.Parse(_strDesZtId);
                            tmp.ID   = 0;
                            db.STDc.InsertOnSubmit(tmp);
                        }

                        DAL.STDT stdt = db.STDT.FirstOrDefault(x => x.SiD == _strSid && x.ZTID.Value.ToString() == _strZid);
                        if (stdt != null)
                        {
                            DAL.STDT tmp = Clone(stdt);
                            tmp.ZTID = int.Parse(_strDesZtId);
                            tmp.ID   = 0;
                            db.STDT.InsertOnSubmit(tmp);
                        }

                        DAL.STEc stec = db.STEc.FirstOrDefault(x => x.Sid == _strSid && x.ZTID.Value.ToString() == _strZid);
                        if (stec != null)
                        {
                            DAL.STEc tmp = Clone(stec);
                            tmp.ZTID = int.Parse(_strDesZtId);
                            tmp.ID   = 0;
                            db.STEc.InsertOnSubmit(tmp);
                        }

                        DAL.STFML stfml = db.STFML.FirstOrDefault(x => x.SiD == _strSid && x.ZTID.Value.ToString() == _strZid);
                        if (stfml != null)
                        {
                            DAL.STFML tmp = Clone(stfml);
                            tmp.ZTID = int.Parse(_strDesZtId);
                            tmp.ID   = 0;
                            db.STFML.InsertOnSubmit(tmp);
                        }

                        DAL.STIpc stipc = db.STIpc.FirstOrDefault(x => x.SiD == _strSid && x.ZTID.Value.ToString() == _strZid);
                        if (stipc != null)
                        {
                            DAL.STIpc tmp = Clone(stipc);
                            tmp.ZTID = int.Parse(_strDesZtId);
                            tmp.ID   = 0;
                            db.STIpc.InsertOnSubmit(tmp);
                        }

                        DAL.STIV stiv = db.STIV.FirstOrDefault(x => x.SiD == _strSid && x.ZTID.Value.ToString() == _strZid);
                        if (stiv != null)
                        {
                            DAL.STIV tmp = Clone(stiv);
                            tmp.ZTID = int.Parse(_strDesZtId);
                            tmp.ID   = 0;
                            db.STIV.InsertOnSubmit(tmp);
                        }

                        DAL.STPa stpa = db.STPa.FirstOrDefault(x => x.SiD == _strSid && x.ZTID.Value.ToString() == _strZid);
                        if (stpa != null)
                        {
                            DAL.STPa tmp = Clone(stpa);
                            tmp.ZTID = int.Parse(_strDesZtId);
                            tmp.ID   = 0;
                            db.STPa.InsertOnSubmit(tmp);
                        }

                        DAL.STPNS stpns = db.STPNS.FirstOrDefault(x => x.SiD == _strSid && x.ZTID.Value.ToString() == _strZid);
                        if (stpns != null)
                        {
                            DAL.STPNS tmp = Clone(stpns);
                            tmp.ZTID = int.Parse(_strDesZtId);
                            tmp.ID   = 0;
                            db.STPNS.InsertOnSubmit(tmp);
                        }

                        DAL.STPR stpr = db.STPR.FirstOrDefault(x => x.SiD == _strSid && x.ZTID.Value.ToString() == _strZid);
                        if (stpr != null)
                        {
                            DAL.STPR tmp = Clone(stpr);
                            tmp.ZTID = int.Parse(_strDesZtId);
                            tmp.ID   = 0;
                            db.STPR.InsertOnSubmit(tmp);
                        }

                        DAL.STZTList stztlist = db.STZTList.FirstOrDefault(x => x.ID == int.Parse(_strDesZtId));
                        if (stztlist != null)
                        {
                            stztlist.AppSum = stztlist.AppSum == null ? 1 : stztlist.AppSum.Value + 1;
                        }
                    }

                    db.SubmitChanges();
                }

                bRs = true;
            }
            catch (Exception ex)
            {
                bRs = false;
            }
            return(bRs);
        }
Exemple #2
0
        public static bool CopyPt(string _strSid, string _strZid, string _strDesZtId)
        {
            bool bRs = false;

            string strSqlTmp = @"delete from show_base where sid='{0}' and ztid={1};"
                               + "delete from st_ans where sid='{0}' and ztid={1};"
                               + "delete from st_cpc where sid='{0}' and ztid={1};"
                               + "delete from st_ct where sid='{0}' and ztid={1};"
                               + "delete from st_dc where sid='{0}' and ztid={1};"
                               + "delete from st_dt where sid='{0}' and ztid={1};"
                               + "delete from st_ec where sid='{0}' and ztid={1};"
                               + "delete from st_fml where sid='{0}' and ztid={1};"
                               + "delete from st_ipc where sid='{0}' and ztid={1};"
                               + "delete from st_iv where sid='{0}' and ztid={1};"
                               + "delete from st_pa where sid='{0}' and ztid={1};"
                               + "delete from st_pns where sid='{0}' and ztid={1};"
                               + "delete from st_pr where sid='{0}' and ztid={1};"
                               + "update st_ztlist set app_sum=app_sum+1 where id={2};";

            try
            {
                //MySqlDbAccess.ExecNoQuery(CommandType.Text, string.Format(strSqlTmp, _strSid, _strZid));

                using (MySqlDataContext db = new MySqlDataContext())
                {
                    DAL.ShowBase stbase = db.ShowBase.FirstOrDefault(x => x.SiD == _strSid && x.ZTID.Value.ToString() == _strZid);
                    if (stbase != null)
                    {
                        DAL.ShowBase tmp = Clone(stbase);
                        tmp.ZTID = int.Parse(_strDesZtId);
                        tmp.ID   = 0;
                        db.ShowBase.InsertOnSubmit(tmp);
                    }

                    DAL.STAnS stans = db.STAnS.FirstOrDefault(x => x.SiD == _strSid && x.ZTID.Value.ToString() == _strZid);
                    if (stans != null)
                    {
                        DAL.STAnS tmp = Clone(stans);
                        tmp.ZTID = int.Parse(_strDesZtId);
                        tmp.ID   = 0;
                        db.STAnS.InsertOnSubmit(tmp);
                    }

                    DAL.STCPc stcpc = db.STCPc.FirstOrDefault(x => x.SiD == _strSid && x.ZTID.Value.ToString() == _strZid);
                    if (stcpc != null)
                    {
                        DAL.STCPc tmp = Clone(stcpc);
                        tmp.ZTID = int.Parse(_strDesZtId);
                        tmp.ID   = 0;
                        db.STCPc.InsertOnSubmit(tmp);
                    }

                    DAL.STCt stct = db.STCt.FirstOrDefault(x => x.SiD == _strSid && x.ZTID.Value.ToString() == _strZid);
                    if (stct != null)
                    {
                        DAL.STCt tmp = Clone(stct);
                        tmp.ZTID = int.Parse(_strDesZtId);
                        tmp.ID   = 0;
                        db.STCt.InsertOnSubmit(tmp);
                    }

                    DAL.STDc stdc = db.STDc.FirstOrDefault(x => x.SiD == _strSid && x.ZTID.Value.ToString() == _strZid);
                    if (stdc != null)
                    {
                        DAL.STDc tmp = Clone(stdc);
                        tmp.ZTID = int.Parse(_strDesZtId);
                        tmp.ID   = 0;
                        db.STDc.InsertOnSubmit(tmp);
                    }

                    DAL.STDT stdt = db.STDT.FirstOrDefault(x => x.SiD == _strSid && x.ZTID.Value.ToString() == _strZid);
                    if (stdt != null)
                    {
                        DAL.STDT tmp = Clone(stdt);
                        tmp.ZTID = int.Parse(_strDesZtId);
                        tmp.ID   = 0;
                        db.STDT.InsertOnSubmit(tmp);
                    }

                    DAL.STEc stec = db.STEc.FirstOrDefault(x => x.Sid == _strSid && x.ZTID.Value.ToString() == _strZid);
                    if (stec != null)
                    {
                        DAL.STEc tmp = Clone(stec);
                        tmp.ZTID = int.Parse(_strDesZtId);
                        tmp.ID   = 0;
                        db.STEc.InsertOnSubmit(tmp);
                    }

                    DAL.STFML stfml = db.STFML.FirstOrDefault(x => x.SiD == _strSid && x.ZTID.Value.ToString() == _strZid);
                    if (stfml != null)
                    {
                        DAL.STFML tmp = Clone(stfml);
                        tmp.ZTID = int.Parse(_strDesZtId);
                        tmp.ID   = 0;
                        db.STFML.InsertOnSubmit(tmp);
                    }

                    DAL.STIpc stipc = db.STIpc.FirstOrDefault(x => x.SiD == _strSid && x.ZTID.Value.ToString() == _strZid);
                    if (stipc != null)
                    {
                        DAL.STIpc tmp = Clone(stipc);
                        tmp.ZTID = int.Parse(_strDesZtId);
                        tmp.ID   = 0;
                        db.STIpc.InsertOnSubmit(tmp);
                    }

                    DAL.STIV stiv = db.STIV.FirstOrDefault(x => x.SiD == _strSid && x.ZTID.Value.ToString() == _strZid);
                    if (stiv != null)
                    {
                        DAL.STIV tmp = Clone(stiv);
                        tmp.ZTID = int.Parse(_strDesZtId);
                        tmp.ID   = 0;
                        db.STIV.InsertOnSubmit(tmp);
                    }

                    DAL.STPa stpa = db.STPa.FirstOrDefault(x => x.SiD == _strSid && x.ZTID.Value.ToString() == _strZid);
                    if (stpa != null)
                    {
                        DAL.STPa tmp = Clone(stpa);
                        tmp.ZTID = int.Parse(_strDesZtId);
                        tmp.ID   = 0;
                        db.STPa.InsertOnSubmit(tmp);
                    }

                    DAL.STPNS stpns = db.STPNS.FirstOrDefault(x => x.SiD == _strSid && x.ZTID.Value.ToString() == _strZid);
                    if (stpns != null)
                    {
                        DAL.STPNS tmp = Clone(stpns);
                        tmp.ZTID = int.Parse(_strDesZtId);
                        tmp.ID   = 0;
                        db.STPNS.InsertOnSubmit(tmp);
                    }

                    DAL.STPR stpr = db.STPR.FirstOrDefault(x => x.SiD == _strSid && x.ZTID.Value.ToString() == _strZid);
                    if (stpr != null)
                    {
                        DAL.STPR tmp = Clone(stpr);
                        tmp.ZTID = int.Parse(_strDesZtId);
                        tmp.ID   = 0;
                        db.STPR.InsertOnSubmit(tmp);
                    }

                    DAL.STZTList stztlist = db.STZTList.FirstOrDefault(x => x.ID == int.Parse(_strDesZtId));
                    if (stztlist != null)
                    {
                        stztlist.AppSum = stztlist.AppSum == null ? 1 : stztlist.AppSum.Value + 1;
                    }

                    db.SubmitChanges();
                }

                bRs = true;
            }
            catch (Exception ex)
            {
                bRs = false;
            }
            return(bRs);
        }