Exemple #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool AddKuan(FMS_Model.fms_kuan model, FMS_Model.shop_progress_payments pmodel)
        {
            List <string> strSqlList = new List <string>();
            string        strSql     = string.Empty;


            strSql = string.Format(@" insert into xmh_fms.fms_kuan (jzdate,jytime,jiefang,daifang,name,number,user_qq,admin_name,admin_id,erp_dakuanhao,status,file_time,confirm_time,dkmassage_id,user_id,acc_type) 
                                       value('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}') ",
                                   model.jzdate, model.jytime, model.jiefang, model.daifang, model.name, model.number, model.user_qq, model.admin_name, model.admin_id, model.erp_dakuanhao, model.status, model.file_time, model.confirm_time, model.dkmassage_id, model.user_id, model.acc_type);
            strSqlList.Add(strSql);



            strSql = string.Format(@" insert into xmh_shop.shop_progress_payments (type,order_sn,add_time,money,user_id,employee_id,emp_code,msg,status,start_valid_time,user_yingshou) 
                                       value('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}') ",
                                   pmodel.type, pmodel.order_sn, pmodel.add_time, pmodel.money, pmodel.user_id, pmodel.employee_id, pmodel.emp_code, pmodel.msg, pmodel.status, pmodel.start_valid_time, pmodel.user_yingshou);
            strSqlList.Add(strSql);

            int rows = DbHelperMySQL.ExecuteSqlTran(strSqlList);

            if (rows >= 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public FMS_Model.shop_progress_payments DataRowToModel(DataRow row)
 {
     FMS_Model.shop_progress_payments model = new FMS_Model.shop_progress_payments();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["type"] != null && row["type"].ToString() != "")
         {
             model.type = int.Parse(row["type"].ToString());
         }
         if (row["order_sn"] != null)
         {
             model.order_sn = row["order_sn"].ToString();
         }
         if (row["add_time"] != null && row["add_time"].ToString() != "")
         {
             model.add_time = int.Parse(row["add_time"].ToString());
         }
         if (row["money"] != null && row["money"].ToString() != "")
         {
             model.money = decimal.Parse(row["money"].ToString());
         }
         if (row["user_id"] != null && row["user_id"].ToString() != "")
         {
             model.user_id = int.Parse(row["user_id"].ToString());
         }
         if (row["employee_id"] != null && row["employee_id"].ToString() != "")
         {
             model.employee_id = int.Parse(row["employee_id"].ToString());
         }
         if (row["emp_code"] != null)
         {
             model.emp_code = row["emp_code"].ToString();
         }
         if (row["msg"] != null)
         {
             model.msg = row["msg"].ToString();
         }
         if (row["status"] != null && row["status"].ToString() != "")
         {
             model.status = int.Parse(row["status"].ToString());
         }
         if (row["start_valid_time"] != null && row["start_valid_time"].ToString() != "")
         {
             model.start_valid_time = int.Parse(row["start_valid_time"].ToString());
         }
         if (row["user_yingshou"] != null && row["user_yingshou"].ToString() != "")
         {
             model.user_yingshou = decimal.Parse(row["user_yingshou"].ToString());
         }
     }
     return(model);
 }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(FMS_Model.shop_progress_payments model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update shop_progress_payments set ");
            strSql.Append("type=@type,");
            strSql.Append("order_sn=@order_sn,");
            strSql.Append("add_time=@add_time,");
            strSql.Append("money=@money,");
            strSql.Append("user_id=@user_id,");
            strSql.Append("employee_id=@employee_id,");
            strSql.Append("emp_code=@emp_code,");
            strSql.Append("msg=@msg,");
            strSql.Append("status=@status,");
            strSql.Append("start_valid_time=@start_valid_time,");
            strSql.Append("user_yingshou=@user_yingshou");
            strSql.Append(" where id=@id ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@type",             MySqlDbType.Int16,     2),
                new MySqlParameter("@order_sn",         MySqlDbType.VarChar,  20),
                new MySqlParameter("@add_time",         MySqlDbType.Int32,    11),
                new MySqlParameter("@money",            MySqlDbType.Decimal,  11),
                new MySqlParameter("@user_id",          MySqlDbType.Int32,    11),
                new MySqlParameter("@employee_id",      MySqlDbType.Int32,     8),
                new MySqlParameter("@emp_code",         MySqlDbType.VarChar,  10),
                new MySqlParameter("@msg",              MySqlDbType.VarChar, 300),
                new MySqlParameter("@status",           MySqlDbType.Int16,     2),
                new MySqlParameter("@start_valid_time", MySqlDbType.Int32,    11),
                new MySqlParameter("@user_yingshou",    MySqlDbType.Decimal,  11),
                new MySqlParameter("@id",               MySqlDbType.Int32, 11)
            };
            parameters[0].Value  = model.type;
            parameters[1].Value  = model.order_sn;
            parameters[2].Value  = model.add_time;
            parameters[3].Value  = model.money;
            parameters[4].Value  = model.user_id;
            parameters[5].Value  = model.employee_id;
            parameters[6].Value  = model.emp_code;
            parameters[7].Value  = model.msg;
            parameters[8].Value  = model.status;
            parameters[9].Value  = model.start_valid_time;
            parameters[10].Value = model.user_yingshou;
            parameters[11].Value = model.id;

            int rows = Shop_DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// 重新认款
        /// </summary>
        public bool KnowKuans(FMS_Model.fms_dkmassage model, FMS_Model.shop_progress_payments progress)
        {
            fms_kuan kuan = new fms_kuan();
            shop_progress_payments _proPayments = new shop_progress_payments();

            List <string> strSqlList = new List <string>();

            string strSql = string.Empty;

            DataSet ds = kuan.GetList(" dkmassage_id='" + model.id + "'");


            //已认款、待收款的重新认款

            strSql = string.Format(@" update fms_dkmassage set stats='{0}',operate_userId='{1}',operate_time='{2}' where id='{3}'", model.stats, model.operate_userId, model.operate_time, model.id);
            strSqlList.Add(strSql);

            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                strSql = string.Format(" Delete from fms_kuan where dkmassage_id='{0}'", model.id);

                //strSql = string.Format(" update fms_kuan  set status ='{0}'where dkmassage_id='{1}'", 1, model.id);

                strSqlList.Add(strSql);
            }

            //3.shop_progress_payments

            DataSet dp = _proPayments.GetLists(" order_sn='" + model.id + "' and type='2' ");

            if (dp != null && dp.Tables[0].Rows.Count > 0)
            {
                strSql = string.Format(" Delete from xmh_shop.shop_progress_payments where order_sn='{0}' and type='{1}' ", model.id, 2);
                //strSql = string.Format(" update  xmh_shop.shop_progress_payments  set status='{0}' where order_sn='{2}'",2, model.id);
                strSqlList.Add(strSql);
            }

            //_proPayments.Add(progress);
            //strSqlList.Add(strSql);

            int rows = FMS_DbHelperMySQL.ExecuteSqlTran(strSqlList);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(FMS_Model.shop_progress_payments model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into shop_progress_payments(");
            strSql.Append("id,type,order_sn,add_time,money,user_id,employee_id,emp_code,msg,status,start_valid_time,user_yingshou)");
            strSql.Append(" values (");
            strSql.Append("@id,@type,@order_sn,@add_time,@money,@user_id,@employee_id,@emp_code,@msg,@status,@start_valid_time,@user_yingshou)");
            strSql.Append(";select @@IDENTITY");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@id",               MySqlDbType.Int32,    11),
                new MySqlParameter("@type",             MySqlDbType.Int16,     2),
                new MySqlParameter("@order_sn",         MySqlDbType.VarChar,  20),
                new MySqlParameter("@add_time",         MySqlDbType.Int32,    11),
                new MySqlParameter("@money",            MySqlDbType.Decimal,  11),
                new MySqlParameter("@user_id",          MySqlDbType.Int32,    11),
                new MySqlParameter("@employee_id",      MySqlDbType.Int32,     8),
                new MySqlParameter("@emp_code",         MySqlDbType.VarChar,  10),
                new MySqlParameter("@msg",              MySqlDbType.VarChar, 300),
                new MySqlParameter("@status",           MySqlDbType.Int16,     2),
                new MySqlParameter("@start_valid_time", MySqlDbType.Int32,    11),
                new MySqlParameter("@user_yingshou",    MySqlDbType.Decimal, 11)
            };
            parameters[0].Value  = model.id;
            parameters[1].Value  = model.type;
            parameters[2].Value  = model.order_sn;
            parameters[3].Value  = model.add_time;
            parameters[4].Value  = model.money;
            parameters[5].Value  = model.user_id;
            parameters[6].Value  = model.employee_id;
            parameters[7].Value  = model.emp_code;
            parameters[8].Value  = model.msg;
            parameters[9].Value  = model.status;
            parameters[10].Value = model.start_valid_time;
            parameters[11].Value = model.user_yingshou;

            object obj = Shop_DbHelperMySQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public FMS_Model.shop_progress_payments GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select id,type,order_sn,add_time,money,user_id,employee_id,emp_code,msg,status,start_valid_time,user_yingshou from shop_progress_payments ");
            strSql.Append(" where id=@id ");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@id", MySqlDbType.Int32, 11)
            };
            parameters[0].Value = id;

            FMS_Model.shop_progress_payments model = new FMS_Model.shop_progress_payments();
            DataSet ds = Shop_DbHelperMySQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemple #7
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Adds(FMS_Model.fms_kuan model, FMS_Model.fms_dkmassage Mmodel, FMS_Model.shop_progress_payments pmodel, DataSet ds)
        {
            List <string> strSqlList = new List <string>();
            string        strSql     = string.Empty;

            strSql = string.Format(@" insert into xmh_fms.fms_kuan (jzdate,jytime,jiefang,daifang,name,number,user_qq,admin_name,admin_id,erp_dakuanhao,status,file_time,confirm_time,dkmassage_id,user_id,acc_type) 
                                       value('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}') ",
                                   model.jzdate, model.jytime, model.jiefang, model.daifang, model.name, model.number, model.user_qq, model.admin_name, model.admin_id, model.erp_dakuanhao, model.status, model.file_time, model.confirm_time, model.dkmassage_id, model.user_id, model.acc_type);
            strSqlList.Add(strSql);

            strSql = string.Format(@" update  xmh_fms.fms_dkmassage set erp_dakuanhao='{0}',confirm_admin_id='{1}',confirm_time='{2}',erp_time='{3}',user_id='{4}',operate_userId='{5}',operate_time='{6}' where id='{7}'",
                                   Mmodel.erp_dakuanhao, Mmodel.confirm_admin_id, Mmodel.confirm_time, Mmodel.erp_time, Mmodel.user_id, Mmodel.operate_userId, Mmodel.operate_time, Mmodel.id);

            strSqlList.Add(strSql);


            strSql = string.Format(@" insert into xmh_shop.shop_progress_payments (type,order_sn,add_time,money,user_id,employee_id,emp_code,msg,status,start_valid_time,user_yingshou) 
                                       value('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}') ",
                                   pmodel.type, pmodel.order_sn, pmodel.add_time, pmodel.money, pmodel.user_id, pmodel.employee_id, pmodel.emp_code, pmodel.msg, pmodel.status, pmodel.start_valid_time, pmodel.user_yingshou);
            strSqlList.Add(strSql);

            if (!string.IsNullOrEmpty(Mmodel.account))
            {
                if (string.IsNullOrEmpty(ds.Tables[0].Rows[0]["bill_bank_code1"].ToString()))
                {
                    strSql = string.Format(@" Update CRM_Contact set bill_bank_code1='{0}' where  id='{1}'", Mmodel.account, ds.Tables[0].Rows[0]["id"].ToString());
                    strSqlList.Add(strSql);
                }
                else if (string.IsNullOrEmpty(ds.Tables[0].Rows[0]["bill_bank_code2"].ToString()))
                {
                    strSql = string.Format(@" Update CRM_Contact set bill_bank_code2='{0}' where  id='{1}'", Mmodel.account, ds.Tables[0].Rows[0]["id"].ToString());
                    strSqlList.Add(strSql);
                }
                else if (string.IsNullOrEmpty(ds.Tables[0].Rows[0]["bill_bank_code3"].ToString()))
                {
                    strSql = string.Format(@" Update CRM_Contact set bill_bank_code3='{0}' where  id='{1}'", Mmodel.account, ds.Tables[0].Rows[0]["id"].ToString());
                    strSqlList.Add(strSql);
                }
                else if (string.IsNullOrEmpty(ds.Tables[0].Rows[0]["bill_bank_code4"].ToString()))
                {
                    strSql = string.Format(@" Update CRM_Contact set bill_bank_code4='{0}' where  id='{1}'", Mmodel.account, ds.Tables[0].Rows[0]["id"].ToString());
                    strSqlList.Add(strSql);
                }
                else if (string.IsNullOrEmpty(ds.Tables[0].Rows[0]["bill_bank_code5"].ToString()))
                {
                    strSql = string.Format(@" Update CRM_Contact set bill_bank_code5='{0}' where  id='{1}'", Mmodel.account, ds.Tables[0].Rows[0]["id"].ToString());
                    strSqlList.Add(strSql);
                }
                else if (string.IsNullOrEmpty(ds.Tables[0].Rows[0]["bill_bank_code6"].ToString()))
                {
                    strSql = string.Format(@" Update CRM_Contact set bill_bank_code6='{0}' where  id='{1}'", Mmodel.account, ds.Tables[0].Rows[0]["id"].ToString());
                    strSqlList.Add(strSql);
                }
                else if (string.IsNullOrEmpty(ds.Tables[0].Rows[0]["bill_alipay_code"].ToString()))
                {
                    strSql = string.Format(@" Update CRM_Contact set bill_alipay_code='{0}' where  id='{1}'", Mmodel.account, ds.Tables[0].Rows[0]["id"].ToString());
                    strSqlList.Add(strSql);
                }
                else if (string.IsNullOrEmpty(ds.Tables[0].Rows[0]["bill_wei_code"].ToString()))
                {
                    strSql = string.Format(@" Update CRM_Contact set bill_wei_code='{0}' where  id='{1}'", Mmodel.account, ds.Tables[0].Rows[0]["id"].ToString());
                    strSqlList.Add(strSql);
                }
            }


            int rows = DbHelperMySQL.ExecuteSqlTran(strSqlList);

            if (rows >= 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }