/// <summary> /// 实体转换 /// <summary> private static Model.GoodCategory TranEntity(DataRow dr) { if (dr != null) { Model.GoodCategory model = new Model.GoodCategory(); if (!string.IsNullOrEmpty(dr["Id"].ToString())) { model.Id = int.Parse(dr["Id"].ToString()); } model.Code = dr["Code"].ToString(); model.Name = dr["Name"].ToString(); model.ParentCode = dr["ParentCode"].ToString(); model.Remark = dr["Remark"].ToString(); if (!string.IsNullOrEmpty(dr["IsDeleted"].ToString())) { model.IsDeleted = bool.Parse(dr["IsDeleted"].ToString()); } if (!string.IsNullOrEmpty(dr["Status"].ToString())) { model.Status = int.Parse(dr["Status"].ToString()); } return(model); } else { return(null); } }
/// <summary> /// 增加一条数据 /// </summary> public static Hashtable Insert(Model.GoodCategory model, Hashtable MyHs) { string guid = Guid.NewGuid().ToString(); StringBuilder strSql = new StringBuilder(); strSql.Append("insert into GoodCategory("); strSql.Append("Code,Name,ParentCode,Remark,IsDeleted,Status"); strSql.Append(") values ("); strSql.Append("@Code,@Name,@ParentCode,@Remark,@IsDeleted,@Status"); strSql.Append(") "); strSql.AppendFormat(";select '{0}'", guid); SqlParameter[] parameters = { new SqlParameter("@Code", SqlDbType.VarChar, 50), new SqlParameter("@Name", SqlDbType.VarChar, 50), new SqlParameter("@ParentCode", SqlDbType.VarChar, 50), new SqlParameter("@Remark", SqlDbType.NVarChar, 1000), new SqlParameter("@IsDeleted", SqlDbType.Bit, 1), new SqlParameter("@Status", SqlDbType.Int, 4) }; parameters[0].Value = model.Code; parameters[1].Value = model.Name; parameters[2].Value = model.ParentCode; parameters[3].Value = model.Remark; parameters[4].Value = model.IsDeleted; parameters[5].Value = model.Status; MyHs.Add(strSql.ToString(), parameters); return(MyHs); }
//添加收货人,并保证只有一个默认收货人 protected override string btnAdd_Click() { string sid = Request.Form["hidId"]; Hashtable myHs = new Hashtable(); Model.GoodCategory obj = null; if (string.IsNullOrEmpty(sid) || sid == "0") { //添加 obj = CategoryModel; //校验编号是否已存在 if (BLL.GoodCategory.GetList("IsDeleted=0 and Code='" + obj.Code + "'").FirstOrDefault() != null) { return("2"); } BLL.GoodCategory.Insert(obj, myHs); } else { obj = CategoryModel; BLL.GoodCategory.Update(obj, myHs); } if (BLL.CommonBase.RunHashtable(myHs)) { return("1"); } return("0"); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { List <Model.Client> list = new BLL.Client().GetList(); ddlGroupId.DataSource = list; ddlGroupId.DataTextField = "ClientName"; ddlGroupId.DataValueField = "ClientID"; ddlGroupId.DataBind(); if (Request.QueryString["GoodCategoryID"] != null) { txtGoodCategoryName.ReadOnly = true; txtGoodCategoryName.Attributes.Remove("ajaxurl"); BLL.GoodCategory bll = new BLL.GoodCategory(); Model.GoodCategory model = new Model.GoodCategory(); model = bll.GetModel(Request.QueryString["GoodCategoryID"]); txtGoodCategoryName.Text = model.GoodCategoryName; //txtGoodBarCode.Text = model.GoodBarCode.ToString(); //txtGoodBarCode.Text = model.GoodBarCode.ToString(); txtBrokerageRatio.Text = model.BrokerageRatio.ToString(); txtIntegralRatio.Text = model.IntegralRatio.ToString(); //txtStandard.Text = model.Standard.ToString(); drpState.SelectedValue = model.State.ToString(); txtRemark.Text = model.Remark; } } }
private void DoAdd() { Model.BarCodeCreateRecord BarCodeCreateRecord = new Model.BarCodeCreateRecord(); BLL.BarCodeCreateRecord bll = new BLL.BarCodeCreateRecord(); Model.manager adminmodel = Session[DTKeys.SESSION_ADMIN_INFO] as Model.manager; BarCodeCreateRecord.GoodCount = int.Parse(txtGoodCount.Text); BarCodeCreateRecord.BoxSum = Convert.ToInt32(txtBoxsum.Text.Trim()); BarCodeCreateRecord.RetrospectCode = txtRetrospect.Text; BarCodeCreateRecord.Operator = adminmodel.id; BarCodeCreateRecord.Batch = txtBatch.Text.Trim(); BarCodeCreateRecord.State = 1; BarCodeCreateRecord.CreateTime = DateTime.Now; BarCodeCreateRecord.Remark = txtRemark.Text; BarCodeCreateRecord.GoodBarCode = txtGoodBarCode.Text.Trim(); //BarCodeCreateRecord.BrokerageRatio = Convert.ToDecimal(txtBrokerageRatio.Text.Trim()); //BarCodeCreateRecord.IntegralRatio = Convert.ToInt32(txtIntegralRatio.Text.Trim()); Model.BarCode BarCode = new Model.BarCode(); BarCode.CreateTime = DateTime.Now; BarCode.State = 1; Model.GoodCategory gc = new Model.GoodCategory(); BLL.GoodCategory bllgc = new BLL.GoodCategory(); try { bll.Add(BarCodeCreateRecord, BarCode); int i = bll.GetMaxID(); if (i != 0) { ExcelOut(i.ToString()); Response.Redirect("/admin/BarCode/BarCodeCreateDetail.aspx?id=" + i); } } catch (Exception e) { } }
protected string GetCategory(string code) { Model.GoodCategory goodC = BLL.GoodCategory.GetModelByCode(code); if (goodC != null) { return(goodC.Name); } return("分类不存在"); }
public List <Model.GoodCategory> GetList() { StringBuilder strSql = new StringBuilder(); strSql.Append("select * from GoodCategory"); Model.GoodCategory model = new Model.GoodCategory(); DataSet ds = DbHelperSQL.Query(strSql.ToString()); List <Model.GoodCategory> list = null; if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { list = Common.DataTableToList.List <Model.GoodCategory>(ds.Tables[0]); } return(list); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string id = context.Request.QueryString["id"]; Model.GoodCategory model = null; BLL.GoodCategory bll = new BLL.GoodCategory(); try { model = bll.GetModel(id); if (model != null) { context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(model)); } } catch (Exception) {} }
public int Add(Model.GoodCategory Model) { StringBuilder strSql = new StringBuilder(); strSql.Append(" insert GoodCategory(UniqueID,ClientID,GoodCategoryName,Operator,BrokerageRatio,IntegralRatio,CreateTime,State,Remark)"); strSql.Append(" values ("); strSql.Append("@UniqueID,@ClientID,@GoodCategoryName,@Operator,@BrokerageRatio,@IntegralRatio,@CreateTime,@State,@Remark)"); SqlParameter[] parameters = { new SqlParameter("@UniqueID", SqlDbType.UniqueIdentifier), new SqlParameter("@ClientID", SqlDbType.Int, 8), new SqlParameter("@GoodCategoryName", SqlDbType.NVarChar, 100), new SqlParameter("@Operator", SqlDbType.Int, 8), //new SqlParameter("@GoodBarCode", SqlDbType.VarChar,10), new SqlParameter("@BrokerageRatio", SqlDbType.Money), new SqlParameter("@IntegralRatio", SqlDbType.Int, 8), //new SqlParameter("@Standard", SqlDbType.Int,8), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@State", SqlDbType.Int, 8), new SqlParameter("@Remark", SqlDbType.NText) }; parameters[0].Value = Model.UniqueID; parameters[1].Value = Model.ClientID; parameters[2].Value = Model.GoodCategoryName; parameters[3].Value = Model.Operator; //parameters[4].Value = Model.GoodBarCode; parameters[4].Value = Model.BrokerageRatio; parameters[5].Value = Model.IntegralRatio; //parameters[7].Value = Model.Standard; parameters[6].Value = Model.CreateTime; parameters[7].Value = Model.State; parameters[8].Value = Model.Remark; object obj = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
public int Edit(Model.GoodCategory Model) { StringBuilder strSql = new StringBuilder(); strSql.Append(" update GoodCategory set ClientID=@ClientID,GoodCategoryName=@GoodCategoryName,Operator=@Operator,CreateTime=@CreateTime,State=@State,Remark=@Remark where GoodCategoryID=@GoodCategoryID"); SqlParameter[] parameters = { new SqlParameter("@GoodCategoryID", SqlDbType.Int, 8), new SqlParameter("@ClientID", SqlDbType.Int, 8), new SqlParameter("@GoodCategoryName", SqlDbType.NVarChar, 100), new SqlParameter("@Operator", SqlDbType.Int, 8), //new SqlParameter("@GoodBarCode", SqlDbType.VarChar,10), //new SqlParameter("@BrokerageRatio", SqlDbType.Money), //new SqlParameter("@IntegralRatio", SqlDbType.Int,8), //new SqlParameter("@Standard", SqlDbType.Int,8), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@State", SqlDbType.Int, 8), new SqlParameter("@Remark", SqlDbType.NText) }; parameters[0].Value = Model.GoodCategoryID; parameters[1].Value = Model.ClientID; parameters[2].Value = Model.GoodCategoryName; parameters[3].Value = Model.Operator; //parameters[4].Value = Model.GoodBarCode; //parameters[5].Value = Model.BrokerageRatio; //parameters[6].Value = Model.IntegralRatio; //parameters[7].Value = Model.Standard; parameters[4].Value = Model.CreateTime; parameters[5].Value = Model.State; parameters[6].Value = Model.Remark; object obj = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
private void Edit() { Model.manager adminmodel = Session[DTKeys.SESSION_ADMIN_INFO] as Model.manager; Model.GoodCategory model = new Model.GoodCategory(); BLL.GoodCategory bll = new BLL.GoodCategory(); model.GoodCategoryID = int.Parse(Request.QueryString["GoodCategoryID"]); model.ClientID = int.Parse(ddlGroupId.SelectedValue); model.GoodCategoryName = txtGoodCategoryName.Text; model.BrokerageRatio = decimal.Parse(txtBrokerageRatio.Text); model.IntegralRatio = int.Parse(txtIntegralRatio.Text); //model.GoodBarCode = txtGoodBarCode.Text; model.Operator = adminmodel.id; //model.Standard = int.Parse(txtStandard.Text); model.State = int.Parse(drpState.SelectedValue); model.CreateTime = DateTime.Now; model.Remark = txtRemark.Text; if (bll.Edit(model) > 0) { Response.Redirect("/admin/client/ClientGoodList.aspx"); } }
public Model.GoodCategory GetModel(string GoodCategoryID) { StringBuilder strSql = new StringBuilder(); strSql.Append(" select * from GoodCategory with(nolock) where GoodCategoryID=@GoodCategoryID"); SqlParameter[] parameters = { new SqlParameter("@GoodCategoryID", SqlDbType.VarChar, 20) }; parameters[0].Value = GoodCategoryID; DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); Model.GoodCategory model = Common.DataTableToList.List <Model.GoodCategory>(ds.Tables[0])[0]; if (model == null) { return(null); } else { return(model); } }
/// <summary> /// 更新一条数据 /// </summary> public static Hashtable Update(Model.GoodCategory model, Hashtable MyHs) { string guid = Guid.NewGuid().ToString(); StringBuilder strSql = new StringBuilder(); strSql.Append("update GoodCategory set "); strSql.Append(" Code = @Code , "); strSql.Append(" Name = @Name , "); strSql.Append(" ParentCode = @ParentCode , "); strSql.Append(" Remark = @Remark , "); strSql.Append(" IsDeleted = @IsDeleted , "); strSql.Append(" Status = @Status "); strSql.Append(" where Id=@Id "); strSql.AppendFormat(" ;select '{0}'", guid); SqlParameter[] parameters = { new SqlParameter("@Id", SqlDbType.Int, 4), new SqlParameter("@Code", SqlDbType.VarChar, 50), new SqlParameter("@Name", SqlDbType.VarChar, 50), new SqlParameter("@ParentCode", SqlDbType.VarChar, 50), new SqlParameter("@Remark", SqlDbType.NVarChar, 1000), new SqlParameter("@IsDeleted", SqlDbType.Bit, 1), new SqlParameter("@Status", SqlDbType.Int, 4) }; parameters[0].Value = model.Id; parameters[1].Value = model.Code; parameters[2].Value = model.Name; parameters[3].Value = model.ParentCode; parameters[4].Value = model.Remark; parameters[5].Value = model.IsDeleted; parameters[6].Value = model.Status; MyHs.Add(strSql.ToString(), parameters); return(MyHs); }
public override void ProcessRequest(HttpContext context) { base.ProcessRequest(context); string strWhere = " '1'='1' "; string state = string.Empty; if (!string.IsNullOrEmpty(context.Request["txtKey"])) { strWhere += " and GParentCode ='" + context.Request["txtKey"] + "' "; } if (!string.IsNullOrEmpty(context.Request["tState"])) { state = context.Request["tState"]; } int count; List <Model.Goods> List = BLL.Goods.GetList(strWhere, pageIndex, pageSize, out count); StringBuilder sb = new StringBuilder(); for (int i = 0; i < List.Count; i++) { sb.Append(List[i].GID + "~"); sb.Append((i + 1) + (pageIndex - 1) * pageSize + "~"); Model.GoodCategory cst = BLL.GoodCategory.GetModelByCode(List[i].GParentCode); if (cst != null) { sb.Append(cst.Name + "~"); } else { sb.Append(List[i].GParentCode + "~"); } //if (state == "1") //{ //查询到主图片 //Model.GoodsPic pic = List[i].GoodsPic.FirstOrDefault(c => c.IsMain == true); //if (pic != null) sb.Append("<img class='appImg' alt=\"" + List[i].GName + "\" src='" + List[i].ImageAddr + "'/>"); sb.Append(List[i].GName + "~"); //} //else //{ // sb.Append(List[i].GName + "~"); //} //sb.Append(List[i].CostPrice + "/" + List[i].Unit + "~"); sb.Append(List[i].SellingCount + "~"); if (state == "1") { sb.Append(List[i].SelledCount + "~"); sb.Append("<input type='button' value='详细' class='btn btn-danger btn-small' onclick='lookMoreInfo(" + List[i].GID + ")'/>"); sb.Append("≌"); } else { sb.Append(List[i].SelledCount); sb.Append("≌"); } } var info = new { PageData = Traditionalized(sb), TotalCount = count }; context.Response.Write(JavaScriptConvert.SerializeObject(info)); }
/// <summary> /// 更新一条数据 /// </summary> public static bool Update(Model.GoodCategory model) { return(DAL.CommonBase.RunHashtable(Update(model, new Hashtable()))); }
public int Edit(Model.GoodCategory Model) { return(dal.Edit(Model)); }
public static Hashtable Update(Model.GoodCategory model, Hashtable MyHs) { return(yny_003.DAL.GoodCategory.Update(model, MyHs)); }
public static Hashtable Insert(Model.GoodCategory model, Hashtable MyHs) { return(yny_003.DAL.GoodCategory.Insert(model, MyHs)); }
public static bool Insert(Model.GoodCategory model) { return(yny_003.DAL.GoodCategory.Insert(model)); }
/// <summary> /// 增加一条数据 /// </summary> public static bool Insert(Model.GoodCategory model) { return(DAL.CommonBase.RunHashtable(Insert(model, new Hashtable()))); }
public static bool Update(Model.GoodCategory model) { return(yny_003.DAL.GoodCategory.Update(model)); }
public int Add(Model.GoodCategory Model) { return(dal.Add(Model)); }