protected void uiButtonCancel_Click(object sender, EventArgs e)
 {
     uiPanelViewServices.Visible = true;
     uiPanelEdit.Visible = false;
     CurrentService = null;
     ClearFields();
 }
        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")
     {
         Services objData = new Services();
         objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
         uiTextBoxEnName.Text = objData.EnName;
         uiTextBoxArName.Text = objData.ArName;
         uiFCKeditorArDesc.Value = Server.HtmlDecode(objData.ArDescription);
         uiFCKeditorEnDesc.Value = Server.HtmlDecode(objData.EnDescription);
         uiDropDownListServiceTypes.SelectedValue = objData.TypeID.ToString();
         //uiDropDownListAllCategories.SelectedValue = objData.CategoryID.ToString();
         CurrentService = objData;
         uiPanelViewServices.Visible = false;
         uiPanelEdit.Visible = true;
     }
     else if (e.CommandName == "DeleteService")
     {
         Services objData = new Services();
         objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
         objData.MarkAsDeleted();
         objData.Save();
         BindAll();
     }
 }
        private void BindData()
        {
            BLL.Services objData = new BLL.Services();
            Companies objCompany = new Companies();
            objCompany.GetCompanyByUserName(User.Identity.Name);

            objData.GetServicesByCompanyIDAndTypeID(objCompany.CompanyID, string.IsNullOrEmpty(uiDropDownListAllServiceType.SelectedValue) ? 0 : Convert.ToInt32(uiDropDownListAllServiceType.SelectedValue));
            uiGridViewServices.DataSource = objData.DefaultView;
            uiGridViewServices.DataBind();
        }
 protected void uiLinkButtonAdd_Click(object sender, EventArgs e)
 {
     Clearfields();
     CurrentServices = null;
     uiPanelEdit.Visible = true;
     uiPanelViewServices.Visible = false;
 }