private bool DoEdit(int _id) { bool result = false; BLL.gift bll = new BLL.gift(); Model.gift model = bll.GetModel(_id); model.brand_id = Utils.StrToInt(ddlYear.SelectedValue + ddlMonth.SelectedValue, 0); model.gift_code = txtCode.Text; string type = ddlType.SelectedValue.Trim(); model.title = txtTitle.Text.Trim(); model.img_url = txtImgUrl.Text; model.type = type; //if (type == "2") //{ // model.article_list = ",0,"; // model.quantity = Utils.StrToInt(quantity.Text, 0); // model.amount = 0M; //} //else model.article_list = article_list.Text; if (type == "1") { //model.article_list = ",0,"; model.quantity = 0; model.amount = Utils.StrToDecimal(amount.Text, 0); } if (cbStatus.Checked) { model.status = 1; } else { model.status = 0; } model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99); model.left_quantity = Utils.StrToInt(txtLeftQuantity.Text, 0); model.content = txtContent.Value; if (bll.Update(model)) { AddAdminLog(TWEnums.ActionEnum.Edit.ToString(), "修改贈品:" + model.title); //記錄日誌 result = true; } return(result); }
private void ShowInfo(int _id) { BLL.gift bll = new BLL.gift(); Model.gift model = bll.GetModel(_id); try { ddlYear.SelectedValue = model.brand_id.ToString().Substring(1, 4); ddlMonth.SelectedValue = model.brand_id.ToString().Substring(4, 2); } catch (Exception eee) { } txtCode.Text = model.gift_code; txtTitle.Text = model.title; txtImgUrl.Text = model.img_url; ddlType.SelectedValue = model.type; article_list.Text = model.article_list; quantity.Text = model.quantity.ToString(); amount.Text = model.amount.ToString(); txtSortId.Text = model.sort_id.ToString(); cbStatus.Checked = (model.status == 1); txtLeftQuantity.Text = model.left_quantity.ToString(); txtContent.Value = model.content; }