protected void uiButtonUpdate_Click(object sender, EventArgs e) { if (CurrentServices != null) { BLL.Services objData = CurrentServices; objData.EnName = uiTextBoxEnName.Text; objData.ArName = uiTextBoxArName.Text; objData.EnDescription = Server.HtmlEncode(uiFCKeditorEnDesc.Value); objData.ArDescription = Server.HtmlEncode(uiFCKeditorArDesc.Value); objData.Save(); } else { Companies objCompany = new Companies(); objCompany.GetCompanyByUserName(User.Identity.Name); BLL.Services objData = new BLL.Services(); objData.AddNew(); objData.CompanyID = objCompany.CompanyID; objData.EnName = uiTextBoxEnName.Text; objData.ArName = uiTextBoxArName.Text; objData.EnDescription = Server.HtmlEncode(uiFCKeditorEnDesc.Value); objData.ArDescription = Server.HtmlEncode(uiFCKeditorArDesc.Value); objData.TypeID = Convert.ToInt32(uiDropDownListAllServiceType.SelectedValue); objData.CreatedDate = DateTime.Now; objData.Save(); } uiPanelEdit.Visible = false; uiPanelViewServices.Visible = true; Clearfields(); CurrentServices = null; }
protected void uiGridViewServices_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditService") { BLL.Services objData = new BLL.Services(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); uiTextBoxEnName.Text = objData.EnName; uiTextBoxArName.Text = objData.ArName; uiFCKeditorEnDesc.Value = Server.HtmlDecode(objData.EnDescription); uiFCKeditorArDesc.Value = Server.HtmlDecode(objData.ArDescription); uiPanelViewServices.Visible = false; uiPanelEdit.Visible = true; CurrentServices = objData; } else if (e.CommandName == "DeleteService") { BLL.Services objData = new BLL.Services(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); objData.MarkAsDeleted(); objData.Save(); BindData(); } }