private T_Sobao SetItem() { T_Sobao _obj = new T_Sobao(); if (Page.Request.Params["id"] != null) { _obj.Ma_Sobao = int.Parse(Page.Request["id"].ToString()); } else { _obj.Ma_Sobao = 0; } _obj.Ten_Sobao = UltilFunc.SqlFormatText(this.txt_Tensobao.Text.Trim()); _obj.Mota = this.txt_Mota.Text.Trim(); if (this.txt_NgayXB.Text.Length > 0) { _obj.Ngay_Xuatban = UltilFunc.ToDate(this.txt_NgayXB.Text, "dd/MM/yyyy"); } _obj.Ma_AnPham = Convert.ToInt32(this.ddl_AnPham.SelectedValue.ToString()); _obj.Ngaytao = DateTime.Now; _obj.Ngaysua = DateTime.Now; _obj.Nguoitao = _user.UserID; _obj.Nguoisua = _user.UserID; return(_obj); }
protected void ddl_Sobao_SelectedIndexChanged(object sender, EventArgs e) { if (ddl_Sobao.SelectedIndex > 0) { T_Sobao _sobao = new T_Sobao(); SobaoDAL _sobaoDAL = new SobaoDAL(); _sobao = _sobaoDAL.GetOneFromT_SobaoByID(Convert.ToInt32(ddl_Sobao.SelectedValue.ToString())); this.txt_NgayPhatHanh.Text = _sobao.Ngay_Xuatban.ToString("dd/MM/yyyy"); } }
public int InsertT_Sobao(T_Sobao _Obj) { try { return(HPCDataProvider.Instance().InsertObjectReturn(_Obj, "[Sp_InsertT_Sobao]")); } catch (Exception ex) { throw ex; } }
private void GetItem(int _id) { T_Sobao _Sobao = new T_Sobao(); SobaoDAL _sobaoDAL = new SobaoDAL(); _Sobao = _sobaoDAL.GetOneFromT_SobaoByID(_id); this.txt_Tensobao.Text = _Sobao.Ten_Sobao; this.txt_Mota.Text = _Sobao.Mota; this.txt_NgayXB.Text = _Sobao.Ngay_Xuatban.ToString("dd/MM/yyyy"); this.ddl_AnPham.SelectedIndex = UltilFunc.GetIndexControl(ddl_AnPham, _Sobao.Ma_AnPham.ToString()); ddl_AnphamMau.Items.Clear(); //UltilFunc.BindCombox(ddl_AnphamMau, "MA_Mau", "Mota", "T_AnPhamMau", " Ma_Anpham = " + _Sobao.Ma_AnPham.ToString()); }
protected void Save_Click(object sender, EventArgs e) { #region GhiLog Lichsu_Thaotac_HethongDAL actionDAL = new Lichsu_Thaotac_HethongDAL(); T_Lichsu_Thaotac_Hethong action = new T_Lichsu_Thaotac_Hethong(); action.Ma_Nguoidung = _user.UserID; action.TenDaydu = _user.UserFullName; action.HostIP = IpAddress(); action.NgayThaotac = DateTime.Now; #endregion this.Page.Validate(vs_Themmoi.ValidationGroup); if (!Page.IsValid) { return; } SobaoDAL _sobaoDAL = new SobaoDAL(); Layout_SobaoDAL _layoutSobaoDAL = new Layout_SobaoDAL(); T_Sobao _sobao = SetItem(); int menuID = 0; if (Request["ID"] != null && Request["ID"].ToString() != "" && Request["ID"].ToString() != String.Empty) { menuID = int.Parse(Request["ID"].ToString()); } int _return = _sobaoDAL.InsertT_Sobao(_sobao); if (Page.Request.Params["id"] == null) { _layoutSobaoDAL.AutoInsertT_Layout_Sobao(_return, Convert.ToInt32(ddl_AnPham.SelectedValue.ToString())); action.Thaotac = "[Thêm mới số báo]-->[mã số báo:" + _return.ToString() + " ]"; System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alert('" + Global.RM.GetString("VALIDATE_ADDNEWS") + "');", true); actionDAL.InserT_Lichsu_Thaotac_Hethong(action); Clear(); BindCombo(); return; } if (Page.Request.Params["id"] != null) { action.Thaotac = "[Sửa số báo]-->[Mã số báo:" + Page.Request["id"].ToString() + " ]"; System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alert('" + Global.RM.GetString("UpdateSuccessfully") + "');", true); actionDAL.InserT_Lichsu_Thaotac_Hethong(action); Clear(); BindCombo(); return; } }