public ContentResult PublishMvhSpc(string txtName,string txtMvhSpcType,string txtPlace,string txtMoblie,string carTypeInfo, decimal txtCostStart, string decription) { #region - paras - int resultInt = 0; MvhSpcPersonModel mvhSpcModel = new MvhSpcPersonModel(); mvhSpcModel.F_Bjp_UID = "000000000000000000"; mvhSpcModel.F_BjpCarTypeID = (int)(CarTypeInfoEnum)Enum.Parse(typeof(CarTypeInfoEnum), carTypeInfo); mvhSpcModel.F_BjpCostStart = txtCostStart; mvhSpcModel.F_BjpDecription = decription; mvhSpcModel.F_Name = txtName; mvhSpcModel.F_Place = txtPlace; mvhSpcModel.F_MvhSpcType = (int)(MvhSpcType)Enum.Parse(typeof(MvhSpcType), txtMvhSpcType); mvhSpcModel.F_Mobile = txtMoblie; #endregion #region - result - resultInt = mvhSpcBll.InserMvhSpcPerson(mvhSpcModel); return Content((resultInt>0).ToString()); #endregion }
/// <summary> /// 记录搬家专人信息 /// </summary> /// <param name="mvhSpcModel">搬家专人信息实体</param> /// <returns></returns> public int InserMvhSpcPerson(MvhSpcPersonModel mvhSpcModel) { return mvhSpcDal.InserMvhSpcPerson(mvhSpcModel); }
/// <summary> /// 转换至实体:MvhSpcPersonModel /// </summary> /// <param name="row"></param> /// <returns></returns> public MvhSpcPersonModel TransMvhSpcPersonModel(DataRow row) { MvhSpcPersonModel mvhSpcModel = new MvhSpcPersonModel(); mvhSpcModel.F_Bjp_ID = row["f_Bjp_ID"] != null ? Convert.ToInt32(row["f_Bjp_ID"]) : 0; mvhSpcModel.F_Bjp_UID = row["f_Bjp_UID"] != null ? row["f_Bjp_UID"].ToString() : string.Empty; mvhSpcModel.F_BjpCarTypeID = row["f_BjpCarTypeID"] != null ? Convert.ToInt32(row["f_BjpCarTypeID"]) : 0; mvhSpcModel.F_BjpCostStart = row["f_BjpCostStart"] != null ? Convert.ToDecimal(row["f_BjpCostStart"]) : 0; mvhSpcModel.F_BjpCostEnd = row["f_BjpCostEnd"] != null ? Convert.ToDecimal(row["f_BjpCostEnd"]) : 0; mvhSpcModel.F_BjpDecription = row["f_BjpDecription"] != null ? row["f_BjpDecription"].ToString() : string.Empty; mvhSpcModel.F_InsetTime = row["f_InsertTime"] != null ? Convert.ToDateTime(row["f_InsertTime"]) : DateTime.MinValue; mvhSpcModel.F_UpdateTime = row["f_UpdateTime"] != null ? Convert.ToDateTime(row["f_UpdateTime"]) : DateTime.MinValue; return mvhSpcModel; }
/// <summary> /// 生成专人搬家信息 /// </summary> /// <param name="mvhSpcModel">搬家专人信息实体</param> /// <returns></returns> public int InserMvhSpcPerson(MvhSpcPersonModel mvhSpcModel) { int resultInt = 0; #region - sql qy - string sqlQy = @"INSERT INTO `movehouse`.`mvhspcinfo` (`f_Bjp_UID`, `f_BjpCarTypeID`, `f_Name`, `f_mvhSpcType`, `f_place`, `f_mobile`, `f_BjpCostStart`, `f_BjpDecription`, `f_BjpCostEnd`, `f_InsertTime`, `f_UpdateTime`, `avg1`, `avg2`) VALUES (@f_Bjp_UID, @f_BjpCarTypeID, @f_Name, @f_mvhSpcType, @f_place, @f_mobile, @f_BjpCostStart, @f_BjpDecription, @f_BjpCostEnd, @f_InsertTime, @f_UpdateTime, @avg1, @avg2);;"; #endregion #region - params - MySqlParameter[] paras = { new MySqlParameter("@f_Bjp_UID",mvhSpcModel.F_Bjp_UID), new MySqlParameter("@f_BjpCarTypeID",mvhSpcModel.F_BjpCarTypeID), new MySqlParameter("@f_Name",mvhSpcModel.F_Name), new MySqlParameter("@f_mvhSpcType",mvhSpcModel.F_MvhSpcType), new MySqlParameter("@f_place",1), new MySqlParameter("@f_mobile",mvhSpcModel.F_Mobile), new MySqlParameter("@f_BjpCostStart",mvhSpcModel.F_BjpCostStart), new MySqlParameter("@f_BjpCostEnd",mvhSpcModel.F_BjpCostEnd), new MySqlParameter("@f_BjpDecription",mvhSpcModel.F_BjpDecription), new MySqlParameter("@f_InsertTime",mvhSpcModel.F_InsetTime), new MySqlParameter("@f_UpdateTime",mvhSpcModel.F_UpdateTime), new MySqlParameter("@avg1",string.Empty), new MySqlParameter("@avg2",string.Empty) }; #endregion #region - Excute - try { resultInt = Convert.ToInt32(DbHelperMySql.ExecuteNonQuery(DbHelperMySql.connectionStringManager, System.Data.CommandType.Text, sqlQy, paras)); } catch (Exception ex) { //记录错误信息 throw; } #endregion return resultInt; }