Example #1
0
 private Model.MemberInfo GetModelByDataRow(DataRow dr)
 {
     Model.MemberInfo model = new Model.MemberInfo();
     model.UID      = int.Parse(dr["UID"].ToString());
     model.Code     = dr["Code"].ToString();
     model.TrueName = dr["TrueName"].ToString();
     model.Signed   = dr["Signed"].ToString();
     model.Photo    = dr["Photo"].ToString();
     if (Convert.ToString(dr["Birthday"]) != string.Empty)
     {
         model.Birthday = DateTime.Parse(Convert.ToString(dr["Birthday"]));
     }
     model.PapersType    = int.Parse(dr["PapersType"].ToString());
     model.PapersNumber  = dr["PapersNumber"].ToString();
     model.Province      = int.Parse(dr["Province"].ToString());
     model.City          = int.Parse(dr["City"].ToString());
     model.Borough       = int.Parse(dr["Borough"].ToString());
     model.Address       = dr["Address"].ToString();
     model.OfficePhone   = dr["OfficePhone"].ToString();
     model.HomePhone     = dr["HomePhone"].ToString();
     model.HandPhone     = dr["HandPhone"].ToString();
     model.Fax           = dr["Fax"].ToString();
     model.PersonWebSite = dr["PersonWebSite"].ToString();
     model.QQ            = dr["QQ"].ToString();
     model.ParentId      = int.Parse(dr["ParentId"].ToString());
     model.Parents       = dr["Parents"].ToString();
     model.CRMID         = int.Parse(dr["CRMID"].ToString());
     model.Member_Type   = int.Parse(dr["Member_Type"].ToString());
     model.Member_Class  = int.Parse(dr["Member_Class"].ToString());
     model.Editer        = int.Parse(dr["Editer"].ToString());
     model.OSPId         = int.Parse(dr["OSPId"].ToString());
     model.discount      = (decimal)dr["discount"];
     model.PriceCategory = dr["PriceCategory"] as string;
     return(model);
 }
Example #2
0
 private Model.MemberInfo GetModelByDataSet(DataSet ds)
 {
     Model.MemberInfo model = null;
     if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
     {
         model = GetModelByDataRow(ds.Tables[0].Rows[0]);
     }
     return(model);
 }
Example #3
0
 public Model.MemberInfo DataRowToModelInfo(DataRow row)
 {
     Model.MemberInfo model = new Model.MemberInfo();
     if (row != null)
     {
         if (row["m_ID"] != null && row["m_ID"].ToString() != "")
         {
             model.m_ID = int.Parse(row["m_ID"].ToString());
         }
         if (row["pacount"] != null && row["pacount"].ToString() != "")
         {
             model.pacount = int.Parse(row["pacount"].ToString());
         }
         if (row["addcount"] != null && row["addcount"].ToString() != "")
         {
             model.addcount = int.Parse(row["addcount"].ToString());
         }
         if (row["r_Name"] != null)
         {
             model.r_Name = row["r_Name"].ToString();
         }
         if (row["m_UserName"] != null)
         {
             model.m_UserName = row["m_UserName"].ToString();
         }
         if (row["m_Password"] != null)
         {
             model.m_Password = row["m_Password"].ToString();
         }
         if (row["m_UserType"] != null && row["m_UserType"].ToString() != "")
         {
             model.m_UserType = int.Parse(row["m_UserType"].ToString());
         }
         if (row["m_YingYZZ"] != null)
         {
             model.m_YingYZZ = row["m_YingYZZ"].ToString();
         }
         if (row["m_Score"] != null && row["m_Score"].ToString() != "")
         {
             model.m_Score = int.Parse(row["m_Score"].ToString());
         }
         if (row["m_Rank"] != null && row["m_Rank"].ToString() != "")
         {
             model.m_Rank = int.Parse(row["m_Rank"].ToString());
         }
         if (row["m_NickName"] != null)
         {
             model.m_NickName = row["m_NickName"].ToString();
         }
         if (row["m_RealName"] != null)
         {
             model.m_RealName = row["m_RealName"].ToString();
         }
         if (row["m_Sex"] != null && row["m_Sex"].ToString() != "")
         {
             model.m_Sex = int.Parse(row["m_Sex"].ToString());
         }
         if (row["m_Birthday"] != null && row["m_Birthday"].ToString() != "")
         {
             model.m_Birthday = DateTime.Parse(row["m_Birthday"].ToString());
         }
         if (row["m_Phone"] != null)
         {
             model.m_Phone = row["m_Phone"].ToString();
         }
         if (row["m_Email"] != null)
         {
             model.m_Email = row["m_Email"].ToString();
         }
         if (row["m_QQ"] != null)
         {
             model.m_QQ = row["m_QQ"].ToString();
         }
         if (row["m_CreatedOn"] != null && row["m_CreatedOn"].ToString() != "")
         {
             model.m_CreatedOn = DateTime.Parse(row["m_CreatedOn"].ToString());
         }
         if (row["m_ZheK"] != null && row["m_ZheK"].ToString() != "")
         {
             model.m_ZheK = decimal.Parse(row["m_ZheK"].ToString());
         }
         if (row["m_StatusCode"] != null && row["m_StatusCode"].ToString() != "")
         {
             model.m_StatusCode = int.Parse(row["m_StatusCode"].ToString());
         }
         if (row["m_ShenPstatus"] != null && row["m_ShenPstatus"].ToString() != "")
         {
             model.m_ShenPstatus = int.Parse(row["m_ShenPstatus"].ToString());
         }
         if (row["m_GDPhone"] != null && row["m_GDPhone"].ToString() != "")
         {
             model.m_GDPhone = row["m_GDPhone"].ToString();
         }
         if (row["m_Introduction"] != null && row["m_Introduction"].ToString() != "")
         {
             model.m_Introduction = row["m_Introduction"].ToString();
         }
         if (row["m_GongSiName"] != null && row["m_GongSiName"].ToString() != "")
         {
             model.m_GongSiName = row["m_GongSiName"].ToString();
         }
         if (row["m_GongSiDiQu"] != null && row["m_GongSiDiQu"].ToString() != "")
         {
             model.m_GongSiDiQu = row["m_GongSiDiQu"].ToString();
         }
         if (row["m_GongSiAddress"] != null && row["m_GongSiAddress"].ToString() != "")
         {
             model.m_GongSiAddress = row["m_GongSiAddress"].ToString();
         }
         if (row["m_CloseDate"] != null && row["m_CloseDate"].ToString() != "")
         {
             model.m_CloseDate = DateTime.Parse(row["m_CloseDate"].ToString());
         }
         if (row["m_HeadImg"] != null && row["m_HeadImg"].ToString() != "")
         {
             model.m_HeadImg = row["m_HeadImg"].ToString();
         }
         if (row["m_Provice"] != null && row["m_Provice"].ToString() != "")
         {
             model.m_Provice = int.Parse(row["m_Provice"].ToString());
         }
         if (row["m_City"] != null && row["m_City"].ToString() != "")
         {
             model.m_City = int.Parse(row["m_City"].ToString());
         }
         if (row["m_Count"] != null && row["m_Count"].ToString() != "")
         {
             model.m_Count = int.Parse(row["m_Count"].ToString());
         }
         if (row["m_mailyanzheng"] != null)
         {
             model.m_mailyanzheng = bool.Parse(row["m_mailyanzheng"].ToString());
         }
         if (row["m_ZhiYe"] != null)
         {
             model.m_ZhiYe = row["m_ZhiYe"].ToString();
         }
         if (row["VCcount"] != null && row["VCcount"].ToString() != "")
         {
             model.VCcount = int.Parse(row["VCcount"].ToString());
         }
         if (row["Ocount"] != null && row["Ocount"].ToString() != "")
         {
             model.Ocount = int.Parse(row["Ocount"].ToString());
         }
     }
     return model;
 }
Example #4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Model.MemberInfo model, bool Checked = false)
        {
            StringBuilder strSql  = new StringBuilder();
            StringBuilder strSql1 = new StringBuilder();
            StringBuilder strSql2 = new StringBuilder();

            strSql1.Append("UID,");
            strSql2.Append("" + model.UID + ",");
            if (model.TrueName != null)
            {
                strSql1.Append("TrueName,");
                strSql2.Append("'" + model.TrueName + "',");
            }
            if (model.Signed != null)
            {
                strSql1.Append("Signed,");
                strSql2.Append("'" + model.Signed + "',");
            }
            if (model.Photo != null)
            {
                strSql1.Append("Photo,");
                strSql2.Append("'" + model.Photo + "',");
            }
            if (model.Birthday != null)
            {
                strSql1.Append("Birthday,");
                strSql2.Append("'" + model.Birthday + "',");
            }
            if (model.PapersType != null)
            {
                strSql1.Append("PapersType,");
                strSql2.Append("'" + model.PapersType + "',");
            }
            if (model.PapersNumber != null)
            {
                strSql1.Append("PapersNumber,");
                strSql2.Append("'" + model.PapersNumber + "',");
            }
            if (model.Province != null)
            {
                strSql1.Append("Province,");
                strSql2.Append("" + model.Province + ",");
            }
            if (model.City != null)
            {
                strSql1.Append("City,");
                strSql2.Append("" + model.City + ",");
            }
            if (model.Borough != null)
            {
                strSql1.Append("Borough,");
                strSql2.Append("" + model.Borough + ",");
            }
            if (model.Address != null)
            {
                strSql1.Append("Address,");
                strSql2.Append("'" + model.Address + "',");
            }
            if (model.OfficePhone != null)
            {
                strSql1.Append("OfficePhone,");
                strSql2.Append("'" + model.OfficePhone + "',");
            }
            if (model.HomePhone != null)
            {
                strSql1.Append("HomePhone,");
                strSql2.Append("'" + model.HomePhone + "',");
            }
            if (model.HandPhone != null)
            {
                strSql1.Append("HandPhone,");
                strSql2.Append("'" + model.HandPhone + "',");
            }
            if (model.Fax != null)
            {
                strSql1.Append("Fax,");
                strSql2.Append("'" + model.Fax + "',");
            }
            if (model.PersonWebSite != null)
            {
                strSql1.Append("PersonWebSite,");
                strSql2.Append("'" + model.PersonWebSite + "',");
            }
            if (model.QQ != null)
            {
                strSql1.Append("QQ,");
                strSql2.Append("'" + model.QQ + "',");
            }
            if (model.ParentId > 0)
            {
                strSql1.Append("ParentId,");
                strSql2.Append("" + model.ParentId + ",");
            }
            if (model.Parents != null)
            {
                strSql1.Append("Parents,");
                strSql2.Append("'" + model.Parents + "',");
            }
            if (model.CRMID != null)
            {
                strSql1.Append("CRMID,");
                strSql2.Append("'" + model.CRMID + "',");
            }
            if (model.Member_Type != null)
            {
                strSql1.Append("Member_Type,");
                strSql2.Append("" + model.Member_Type + ",");
            }
            if (model.Member_Class != null)
            {
                strSql1.Append("Member_Class,");
                strSql2.Append("" + model.Member_Class + ",");
            }
            if (model.Editer != 0)
            {
                strSql1.Append("Editer,");
                strSql2.Append("" + model.Editer + ",");
            }
            if (model.OSPId != 0)
            {
                strSql1.Append("OSPId,");
                strSql2.Append("" + model.OSPId + ",");
            }
            if (model.Code != null)
            {
                strSql1.Append("Code,");
                strSql2.Append("'" + model.Code + "',");
            }
            if (model.PriceCategory != null)
            {
                strSql1.Append("PriceCategory,");
                strSql2.Append("'" + model.PriceCategory + "',");
            }

            strSql.Append("insert into memberinfo(");
            strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1));
            strSql.Append(")");
            strSql.Append(" values (");
            strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1));
            strSql.Append(")");
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            if (db.ExecuteNonQuery(dbCommand) <= 0)
            {
                BLL.MemberAccount abll = new BLL.MemberAccount();
                abll.Delete(model.UID);
                return(false);
            }
            return(true);
        }
Example #5
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.MemberInfo model, bool Checked = false)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update memberinfo set ");
            if (model.TrueName != null)
            {
                strSql.Append("TrueName='" + model.TrueName + "',");
            }
            if (model.Signed != null)
            {
                strSql.Append("Signed='" + model.Signed + "',");
            }
            if (model.Photo != null)
            {
                strSql.Append("Photo='" + model.Photo + "',");
            }
            if (model.Birthday != null)
            {
                strSql.Append("Birthday='" + model.Birthday + "',");
            }
            if (model.PapersType != null)
            {
                strSql.Append("PapersType='" + model.PapersType + "',");
            }
            if (model.PapersNumber != null)
            {
                strSql.Append("PapersNumber='" + model.PapersNumber + "',");
            }
            if (model.Province != null)
            {
                strSql.Append("Province=" + model.Province + ",");
            }
            if (model.City != null)
            {
                strSql.Append("City=" + model.City + ",");
            }
            if (model.Borough != null)
            {
                strSql.Append("Borough=" + model.Borough + ",");
            }
            if (model.Address != null)
            {
                strSql.Append("Address='" + model.Address + "',");
            }
            if (model.OfficePhone != null)
            {
                strSql.Append("OfficePhone='" + model.OfficePhone + "',");
            }
            if (model.HomePhone != null)
            {
                strSql.Append("HomePhone='" + model.HomePhone + "',");
            }
            if (model.HandPhone != null)
            {
                strSql.Append("HandPhone='" + model.HandPhone + "',");
            }
            if (model.Fax != null)
            {
                strSql.Append("Fax='" + model.Fax + "',");
            }
            if (model.PersonWebSite != null)
            {
                strSql.Append("PersonWebSite='" + model.PersonWebSite + "',");
            }
            if (model.QQ != null)
            {
                strSql.Append("QQ='" + model.QQ + "',");
            }
            if (model.ParentId != null)
            {
                strSql.Append("ParentId=" + model.ParentId + ",");
            }
            if (model.Parents != null)
            {
                strSql.Append("Parents='" + model.Parents + "',");
            }
            if (model.CRMID != null)
            {
                strSql.Append("CRMID=" + model.CRMID + ",");
            }
            if (model.Member_Type != null)
            {
                strSql.Append("Member_Type=" + model.Member_Type + ",");
            }
            if (model.Member_Class != null)
            {
                strSql.Append("Member_Class=" + model.Member_Class + ",");
            }
            if (model.Editer != 0)
            {
                strSql.Append("Editer=" + model.Editer + ",");
            }
            if (model.OSPId != 0)
            {
                strSql.Append("OSPId=" + model.OSPId + ",");
            }
            if (model.Code != null)
            {
                strSql.Append("Code='" + model.Code + "',");
            }
            if (model.PriceCategory != null)
            {
                strSql.Append("PriceCategory='" + model.PriceCategory + "',");
            }
            strSql.Append("discount=" + model.discount + ",");
            int n = strSql.ToString().LastIndexOf(",");

            strSql.Remove(n, 1);
            strSql.Append(" where UID=" + model.UID + " ");
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            Model.MemberInfo oldmodel = GetModel(model.UID);
            db.ExecuteNonQuery(dbCommand);
            return(true);
        }