public static string DeleteMasterDataDriver(MasterDataModel.MasterDataDriver item) { string res = DbTransaction.DbToString("sp_DeleteMasterDataDriver", new { Driver_ID = item.Driver_ID, UpdateBy = item.UpdateBy }, true); return(res); }
protected void gv_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e) { BootstrapGridView gv = (BootstrapGridView)sender; MasterDataModel.MasterDataDriver item = new MasterDataModel.MasterDataDriver(); item.Driver_ID = (int)e.Keys[0]; item.UpdateBy = UserProfile.Username; string res = MasterDataEntity.DeleteMasterDataDriver(item); gv.JSProperties["cpRes"] = res; e.Cancel = true; gv.DataBind(); }
protected void gv_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { BootstrapGridView gv = (BootstrapGridView)sender; MasterDataModel.MasterDataDriver item = GetGvValue(gv, (int)e.Keys[0]); string res = MasterDataEntity.EditMasterDataDriver(item); gv.JSProperties["cpRes"] = res; e.Cancel = true; if (res.Contains("Success")) { gv.CancelEdit(); gv.DataBind(); } }
public static string AddMasterDataDriver(MasterDataModel.MasterDataDriver item) { string res = DbTransaction.DbToString("sp_AddMasterDataDriver", new { Transporter_ID = item.Transporter_ID, ImageName = item.ImageName, ImageBytes = item.ImageBytes, Name = item.Name, Birthday = item.Birthday, Address = item.Address, Email = item.Email, Phone1 = item.Phone1, Phone2 = item.Phone2, CreationBy = item.CreationBy }, true); return(res); }
protected MasterDataModel.MasterDataDriver GetGvValue(BootstrapGridView gv, int key = 0) { BootstrapTextBox txtName = gv.FindEditFormTemplateControl("txtName") as BootstrapTextBox; BootstrapComboBox cmbTransportir = gv.FindEditFormTemplateControl("cmbTransportir") as BootstrapComboBox; BootstrapDateEdit deBirthday = gv.FindEditFormTemplateControl("deBirthday") as BootstrapDateEdit; BootstrapMemo txtAddress = gv.FindEditFormTemplateControl("txtAddress") as BootstrapMemo; BootstrapTextBox txtEmail = gv.FindEditFormTemplateControl("txtEmail") as BootstrapTextBox; BootstrapTextBox txtPhone1 = gv.FindEditFormTemplateControl("txtPhone1") as BootstrapTextBox; BootstrapTextBox txtPhone2 = gv.FindEditFormTemplateControl("txtPhone2") as BootstrapTextBox; MasterDataModel.MasterDataDriver item = new MasterDataModel.MasterDataDriver(); item.Driver_ID = key; item.Name = txtName.Text; item.Transporter_ID = Convert.ToInt32(cmbTransportir.Value); if (deBirthday.Value != null) { item.Birthday = deBirthday.Date; } else { item.Birthday = null; } item.Address = txtAddress.Text; item.Email = txtEmail.Text; item.Phone1 = txtPhone1.Text; item.Phone2 = txtPhone2.Text; item.CreationBy = UserProfile.Username; item.UpdateBy = UserProfile.Username; if (Session["DriverPhotoImageName"] != null && Session["DriverPhotoImageBytes"] != null) { item.ImageName = Convert.ToString(Session["DriverPhotoImageName"]); item.ImageBytes = (byte[])Session["DriverPhotoImageBytes"]; Session["DriverPhotoImageName"] = null; Session["DriverPhotoImageBytes"] = null; } return(item); }