Exemple #1
0
 //快速新增联系人保存事件的实现
 void contactsadd_SaveEvent(ContactsInfo contactsInfo)
 {
     contID            = contactsInfo.contID;
     contName          = contactsInfo.contName;
     crmId             = contactsInfo.crmId;
     contDuty          = contactsInfo.contDuty;
     contPhone         = contactsInfo.contPhone;
     this.DialogResult = DialogResult.OK;
 }
        //保存
        private bool Save()
        {
            Dictionary<string, ParamObj> dic = new Dictionary<string, ParamObj>();
            List<SysSQLString> listSql = new List<SysSQLString>();
            //List<SQLObj> listSql = new List<SQLObj>();
            SysSQLString sysSql = new SysSQLString();
            //SQLObj obj = new SQLObj();
            sysSql.cmdType = CommandType.Text;
            sysSql.Param = new Dictionary<string, string>();
            //obj.cmdType = CommandType.Text;
            //obj.Param = new Dictionary<string, ParamObj>();
            string cont_id = Guid.NewGuid().ToString();

            //obj.Param.Add("cont_id", new ParamObj("cont_id", cont_id.ToString(), SysDbType.VarChar));//cont_id
            //obj.Param.Add("cont_name", new ParamObj("cont_name", txtContName.Caption, SysDbType.VarChar));//cont_name
            //obj.Param.Add("enable_flag", new ParamObj("enable_flag", (int)DataSources.EnumEnableFlag.USING, SysDbType.Int));//enable_flag
            //obj.Param.Add("data_source", new ParamObj("data_source", (int)DataSources.EnumDataSources.SELFBUILD, SysDbType.Int));//data_source
            //obj.Param.Add("status", new ParamObj("status", (int)DataSources.EnumStatus.Start, SysDbType.Int, 5));//status
            //obj.Param.Add("create_by", new ParamObj("create_by", GlobalStaticObj.UserID, SysDbType.VarChar));//create_by
            //obj.Param.Add("create_time", new ParamObj("create_time", Common.LocalDateTimeToUtcLong(DateTime.Now), SysDbType.DateTime));//create_time

            sysSql.sqlString = string.Format(@"INSERT INTO [tb_contacts]
                        ([cont_id]
                        ,[cont_name]       
                        ,[cont_tel]
                        ,[enable_flag]
                        ,[data_source]
                        ,[status]
                        ,[create_by]
                        ,[create_time]
                        ,[cont_phone])
                        VALUES
                        ('{0}','{1}',{2},'{3}','{4}','{5}','{6}','{7}',{8})",
            cont_id.ToString(),//cont_id
            txtContName.Caption,//cont_name
            EncryptByDB.GetEncFieldValue(txtContTel.Caption),//cont_tel
            (int)DataSources.EnumEnableFlag.USING,//enable_flag
            (int)DataSources.EnumDataSources.SELFBUILD,//data_source
            (int)DataSources.EnumStatus.Start,//status
            GlobalStaticObj.UserID,//create_by
            Common.LocalDateTimeToUtcLong(DateTime.Now),//create_time
            EncryptByDB.GetEncFieldValue(txtContPhone.Caption));//cont_phone
            //            obj.sqlString = string.Format(@"INSERT INTO [tb_contacts]
            //            ([cont_id]
            //            ,[cont_name]       
            //            ,[cont_tel]
            //            ,[enable_flag]
            //            ,[data_source]
            //            ,[status]
            //            ,[create_by]
            //            ,[create_time]
            //            ,[cont_phone])
            //            VALUES
            //            (@cont_id,@cont_name,{0},@enable_flag,@data_source,@status,@create_by,@create_time,{1})",
            //            EncryptByDB.GetEncFieldValue(txtContTel.Caption),//cont_tel
            //            EncryptByDB.GetEncFieldValue(txtContPhone.Caption));//cont_phone

            //listSql.Add(obj);
            listSql.Add(sysSql);
            if (DBHelper.BatchExeSQLStringMultiByTrans("新增联系人", listSql))
            {
                ContactsInfo continfo = new ContactsInfo();
                continfo.contDuty = string.Empty;
                continfo.contID = cont_id;
                continfo.contName = txtContName.Caption;
                continfo.contPhone = txtContTel.Caption;
                continfo.crmId = string.Empty;
                //保存成功后触发保存事件
                if (SaveEvent != null)
                {
                    SaveEvent.BeginInvoke(continfo, null, null);
                }
                MessageBoxEx.Show("保存成功!");
                return true;
            }
            else
            {
                MessageBoxEx.Show("保存失败!");
                return false;
            }
        }
 //快速新增联系人保存事件的实现
 void contactsadd_SaveEvent(ContactsInfo contactsInfo)
 {
     contID = contactsInfo.contID;
     contName = contactsInfo.contName;
     crmId = contactsInfo.crmId;
     contDuty = contactsInfo.contDuty;
     contPhone = contactsInfo.contPhone;
     this.DialogResult = DialogResult.OK;
 }
Exemple #4
0
        //保存
        private bool Save()
        {
            Dictionary <string, ParamObj> dic     = new Dictionary <string, ParamObj>();
            List <SysSQLString>           listSql = new List <SysSQLString>();
            //List<SQLObj> listSql = new List<SQLObj>();
            SysSQLString sysSql = new SysSQLString();

            //SQLObj obj = new SQLObj();
            sysSql.cmdType = CommandType.Text;
            sysSql.Param   = new Dictionary <string, string>();
            //obj.cmdType = CommandType.Text;
            //obj.Param = new Dictionary<string, ParamObj>();
            string cont_id = Guid.NewGuid().ToString();

            //obj.Param.Add("cont_id", new ParamObj("cont_id", cont_id.ToString(), SysDbType.VarChar));//cont_id
            //obj.Param.Add("cont_name", new ParamObj("cont_name", txtContName.Caption, SysDbType.VarChar));//cont_name
            //obj.Param.Add("enable_flag", new ParamObj("enable_flag", (int)DataSources.EnumEnableFlag.USING, SysDbType.Int));//enable_flag
            //obj.Param.Add("data_source", new ParamObj("data_source", (int)DataSources.EnumDataSources.SELFBUILD, SysDbType.Int));//data_source
            //obj.Param.Add("status", new ParamObj("status", (int)DataSources.EnumStatus.Start, SysDbType.Int, 5));//status
            //obj.Param.Add("create_by", new ParamObj("create_by", GlobalStaticObj.UserID, SysDbType.VarChar));//create_by
            //obj.Param.Add("create_time", new ParamObj("create_time", Common.LocalDateTimeToUtcLong(DateTime.Now), SysDbType.DateTime));//create_time

            sysSql.sqlString = string.Format(@"INSERT INTO [tb_contacts]
                        ([cont_id]
                        ,[cont_name]       
                        ,[cont_tel]
                        ,[enable_flag]
                        ,[data_source]
                        ,[status]
                        ,[create_by]
                        ,[create_time]
                        ,[cont_phone])
                        VALUES
                        ('{0}','{1}',{2},'{3}','{4}','{5}','{6}','{7}',{8})",
                                             cont_id.ToString(),                                  //cont_id
                                             txtContName.Caption,                                 //cont_name
                                             EncryptByDB.GetEncFieldValue(txtContTel.Caption),    //cont_tel
                                             (int)DataSources.EnumEnableFlag.USING,               //enable_flag
                                             (int)DataSources.EnumDataSources.SELFBUILD,          //data_source
                                             (int)DataSources.EnumStatus.Start,                   //status
                                             GlobalStaticObj.UserID,                              //create_by
                                             Common.LocalDateTimeToUtcLong(DateTime.Now),         //create_time
                                             EncryptByDB.GetEncFieldValue(txtContPhone.Caption)); //cont_phone
            //            obj.sqlString = string.Format(@"INSERT INTO [tb_contacts]
            //            ([cont_id]
            //            ,[cont_name]
            //            ,[cont_tel]
            //            ,[enable_flag]
            //            ,[data_source]
            //            ,[status]
            //            ,[create_by]
            //            ,[create_time]
            //            ,[cont_phone])
            //            VALUES
            //            (@cont_id,@cont_name,{0},@enable_flag,@data_source,@status,@create_by,@create_time,{1})",
            //            EncryptByDB.GetEncFieldValue(txtContTel.Caption),//cont_tel
            //            EncryptByDB.GetEncFieldValue(txtContPhone.Caption));//cont_phone

            //listSql.Add(obj);
            listSql.Add(sysSql);
            if (DBHelper.BatchExeSQLStringMultiByTrans("新增联系人", listSql))
            {
                ContactsInfo continfo = new ContactsInfo();
                continfo.contDuty  = string.Empty;
                continfo.contID    = cont_id;
                continfo.contName  = txtContName.Caption;
                continfo.contPhone = txtContTel.Caption;
                continfo.crmId     = string.Empty;
                //保存成功后触发保存事件
                if (SaveEvent != null)
                {
                    SaveEvent.BeginInvoke(continfo, null, null);
                }
                MessageBoxEx.Show("保存成功!");
                return(true);
            }
            else
            {
                MessageBoxEx.Show("保存失败!");
                return(false);
            }
        }