Esempio n. 1
0
        /// <summary>
        /// Its for binding the listboxes initially and Bindling grid first row to the feilds
        /// </summary>
        protected void BindAttributes(int CurrentIndex)
        {
            int GroupId = 0;

            AttributeService.AttributeSettingsClient oClient = new AttributeService.AttributeSettingsClient(ServiceConfig.AttributeSettingsDataEndPoint(), ServiceConfig.AttributeSettingsDataUri());
            //divlistset.Visible = true;
            btnSubmit.Visible = true;
            if (grdGroup.Rows.Count > 0)
            {
                if (CurrentIndex != -2)
                {
                    GroupId = (int)this.grdGroup.DataKeys[CurrentIndex]["GroupId"];
                    string   GroupName        = (string)this.grdGroup.DataKeys[CurrentIndex]["GroupName"];
                    Label    lblGroupIdItem   = (Label)grdGroup.Rows[CurrentIndex].FindControl("lblGroupId");
                    Label    lblGroupNameItem = (Label)grdGroup.Rows[CurrentIndex].FindControl("lblGroupName");
                    CheckBox chkStatusItem    = (CheckBox)grdGroup.Rows[CurrentIndex].FindControl("chkStatus");
                    ViewState["GroupId"] = lblGroupIdItem.Text;
                    txtGroupName.Text    = lblGroupNameItem.Text;
                    chkbxStatus.Checked  = chkStatusItem.Checked;
                }
            }
            ViewState["GroupIdPublic"]     = GroupId;
            lstAllAttribute.DataSource     = oClient.GetGroupAttributes(GroupId, 0, "A");
            lstAllAttribute.DataTextField  = "AttributeName";
            lstAllAttribute.DataValueField = "AttributeId";
            lstAllAttribute.DataBind();

            for (int i = 0; i < lstAllAttribute.Items.Count; i++)
            {
                if (i % 2 == 0)
                {
                    lstAllAttribute.Items[i].Attributes.Add("style", "color:Black;background-color:#f2f2f2;");
                }
                else
                {
                    //lstAllAttribute.Items[i].Attributes.Add("style", "color:Black;background-color:seagreen;");
                }
            }
            lstGroupAttribute.DataSource     = oClient.GetGroupAttributes(GroupId, 0, "Y");
            lstGroupAttribute.DataTextField  = "AttributeName";
            lstGroupAttribute.DataValueField = "AttributeId";
            lstGroupAttribute.DataBind();

            for (int i = 0; i < lstGroupAttribute.Items.Count; i++)
            {
                if (i % 2 == 0)
                {
                    lstGroupAttribute.Items[i].Attributes.Add("style", "color:Black;background-color:#f2f2f2;");
                }
                else
                {
                    //lstGroupAttribute.Items[i].Attributes.Add("style", "color:Black;background-color:seagreen;");
                }
            }
            //  lblMsgGroupName.Visible = true;
        }
Esempio n. 2
0
        protected void grdGroup_Sorting(object sender, GridViewSortEventArgs e)
        {
            AttributeService.AttributeSettingsClient      oClient = new AttributeService.AttributeSettingsClient(ServiceConfig.AttributeSettingsDataEndPoint(), ServiceConfig.AttributeSettingsDataUri());
            List <AttributeService.AttributeSettingsData> oList   = new List <AttributeSettingsData>();

            oList = oClient.GetAttributeGroupList(txtSearch.Text.Trim());
            DataTable dtSortTable = new DataTable();

            dtSortTable = Common.ToDataTable(oList);
            if (dtSortTable != null)
            {
                DataView dvSortedView = new DataView(dtSortTable);

                dvSortedView.Sort = e.SortExpression + " " + ViewState["SortDirection"].ToString();

                grdGroup.DataSource = dvSortedView;
                grdGroup.DataBind();

                if (ViewState["SortDirection"] != null)
                {
                    if (ViewState["SortDirection"].ToString() == "DESC")
                    {
                        ViewState["SortDirection"] = "ASC";
                    }
                    else
                    {
                        ViewState["SortDirection"] = "DESC";
                    }
                }
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Its for binding all group details to grid view
 /// </summary>
 protected void SearchGridFill()
 {
     AttributeService.AttributeSettingsClient oClient = new AttributeService.AttributeSettingsClient(ServiceConfig.AttributeSettingsDataEndPoint(), ServiceConfig.AttributeSettingsDataUri());
     grdGroup.DataSource = oClient.GetAttributeGroupList(txtSearch.Text.Trim());
     grdGroup.DataBind();
 }
Esempio n. 4
0
        private void FillDetails()
        {
            AttributeService.AttributeSettingsClient oClient = new AttributeService.AttributeSettingsClient(ServiceConfig.AttributeSettingsDataEndPoint(), ServiceConfig.AttributeSettingsDataUri());
            int GroupId = ViewState["GroupId"].ToString().ToInt();

            lstAllAttribute.DataSource     = oClient.GetGroupAttributes(GroupId, 0, "A");
            lstAllAttribute.DataTextField  = "AttributeName";
            lstAllAttribute.DataValueField = "AttributeId";
            lstAllAttribute.DataBind();
            for (int i = 0; i < lstAllAttribute.Items.Count; i++)
            {
                if (i % 2 == 0)
                {
                    lstAllAttribute.Items[i].Attributes.Add("style", "color:Black;background-color:#f2f2f2;");
                }
            }
            lstGroupAttribute.DataSource     = oClient.GetGroupAttributes(GroupId, 0, "Y");
            lstGroupAttribute.DataTextField  = "AttributeName";
            lstGroupAttribute.DataValueField = "AttributeId";
            lstGroupAttribute.DataBind();

            AttributeService.AttributeSettingsData oAttributeSettingsData    = new AttributeSettingsData();
            List <AttributeSettingsData>           AttributeSettingsDataTemp = new List <AttributeSettingsData>();

            AttributeSettingsDataTemp = oClient.GetAttributeGroupById(ViewState["GroupId"].ToString().ToInt());
            if (AttributeSettingsDataTemp.Count > 0)
            {
                txtGroupName.Text = AttributeSettingsDataTemp[0].GroupName;
            }
            if (AttributeSettingsDataTemp[0].AttributeStatus)
            {
                chkbxStatus.Checked = true;
            }
        }
Esempio n. 5
0
        protected void grdGroup_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName.Equals("select_one"))
            {
                Clear();
                int RowIndex;
                RowIndex = int.Parse(e.CommandArgument.ToString());
                BindAttributes(RowIndex);
                HiddenField hfLibraryId = (HiddenField)grdGroup.Rows[Convert.ToInt32(e.CommandArgument)].FindControl("hfLibraryId");
                ViewState["LibraryId"] = hfLibraryId.Value;
            }
            if (e.CommandName.Equals("Delete"))
            {
                string strMsg;
                int    RowIndex, GroupId;
                RowIndex = int.Parse(e.CommandArgument.ToString());
                GroupId  = (int)this.grdGroup.DataKeys[RowIndex]["GroupId"];

                AttributeService.AttributeSettingsClient oClient = new AttributeService.AttributeSettingsClient(ServiceConfig.AttributeSettingsDataEndPoint(), ServiceConfig.AttributeSettingsDataUri());
                AttributeService.AttributeSettingsData   oData   = new AttributeSettingsData();
                oData.GroupId = GroupId;
                strMsg        = oClient.DeleteAttributeGroupMaster(oData);
                SearchGridFill();
                Common.ErrorMessage(this, strMsg);
            }
        }
Esempio n. 6
0
        protected void grdLibAttributesGroups_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            string      strMsg;
            int         index      = Convert.ToInt32(e.RowIndex);
            GridViewRow row        = grdSearch.Rows[index];
            Label       lblGroupId = (Label)grdLibAttributesGroups.Rows[Convert.ToInt32(e.RowIndex)].FindControl("lblGroupId");

            AttributeService.AttributeSettingsClient oClient = new AttributeService.AttributeSettingsClient(ServiceConfig.AttributeSettingsDataEndPoint(), ServiceConfig.AttributeSettingsDataUri());
            AttributeService.AttributeSettingsData   oData   = new AttributeService.AttributeSettingsData();
            oData.GroupId = lblGroupId.Text.Trim().ToInt();
            strMsg        = oClient.DeleteAttributeGroupMaster(oData);
            Common.ErrorMessage(this, strMsg);
            FillLibraryAttributesGroups();
        }
Esempio n. 7
0
        /// <summary>
        /// Its for Saving groups to GroupMaster and save its attrubutes to perticular
        /// </summary>
        protected void SaveAttributeGroup()
        {
            //First to add group ID to the Group Master tables
            string strMsg, NewGroupId;

            AttributeService.AttributeSettingsData objData = new AttributeSettingsData();
            objData.GroupId   = ViewState["GroupId"] == null ? 0 : Convert.ToInt16(ViewState["GroupId"].ToString());
            objData.GroupName = txtGroupName.Text;
            // By default library id saving as 0
            objData.LibraryId = ViewState["LibraryId"] == null ? 0 : Convert.ToInt16(ViewState["LibraryId"].ToString());
            if (chkbxStatus.Checked == true)
            {
                objData.AttributeStatus = true;
            }
            else
            {
                objData.AttributeStatus = false;
            }
            objData.User = Session["UserId"].ToString();
            AttributeService.AttributeSettingsClient objSave = new AttributeService.AttributeSettingsClient(ServiceConfig.AttributeSettingsDataEndPoint(), ServiceConfig.AttributeSettingsDataUri());
            strMsg = objSave.SaveAttributeGroupMaster(objData, out NewGroupId);
            //if the new Group ID is invalid / Having any validations error it should  return from here.
            if (NewGroupId == "0")
            {
                Common.ErrorMessage(this, strMsg);
                return;
            }
            //second to Add perticular attributes to group
            AttributeService.AttributeSettingsClient objClient = new AttributeService.AttributeSettingsClient(ServiceConfig.AttributeSettingsDataEndPoint(), ServiceConfig.AttributeSettingsDataUri());
            string DeleteFlag = "Y";

            objData.GroupId     = ViewState["GroupId"] == null ? 0 : Convert.ToInt16(ViewState["GroupId"].ToString());
            objData.AttributeId = 0;
            objData.DeleteFlag  = DeleteFlag;
            objClient.SaveAttributeGroup(objData);
            foreach (ListItem itm in lstGroupAttribute.Items)
            {
                int AttributeId = Convert.ToInt16(itm.Value);
                int GroupId     = Convert.ToInt16(NewGroupId);
                objData.GroupId     = GroupId;
                objData.AttributeId = AttributeId;
                objData.DeleteFlag  = DeleteFlag;

                if (DeleteFlag == "Y")
                {
                    DeleteFlag = "F";
                }
                objClient.SaveAttributeGroup(objData);
            }
            SearchClear();
            Common.SavedMessage(this, strMsg);
        }
Esempio n. 8
0
        private void FillSystemGroups()
        {
            AttributeService.AttributeSettingsClient oClient = new AttributeService.AttributeSettingsClient(ServiceConfig.AttributeSettingsDataEndPoint(), ServiceConfig.AttributeSettingsDataUri());
            AttributeService.AttributeSettingsData   oAttributeSettingsData    = new AttributeSettingsData();
            List <AttributeSettingsData>             AttributeSettingsDataTemp = new List <AttributeSettingsData>();

            AttributeSettingsDataTemp = oClient.GetSysAttributeGroupByLibraryId(ViewState["LibraryId"] == null ? 0 : ViewState["LibraryId"].ToString().ToInt(), true);
            cblGroup.DataSource       = AttributeSettingsDataTemp;
            cblGroup.DataTextField    = "GroupName";
            cblGroup.DataValueField   = "GroupId";
            cblGroup.DataBind();
        }
Esempio n. 9
0
 private void CopySystemGroups()
 {
     AttributeService.AttributeSettingsClient oClient = new AttributeService.AttributeSettingsClient(ServiceConfig.AttributeSettingsDataEndPoint(), ServiceConfig.AttributeSettingsDataUri());
     AttributeService.AttributeSettingsData   oAttributeSettingsData = new AttributeSettingsData();
     oAttributeSettingsData.LibraryId = ViewState["LibraryId"].ToString().ToInt();
     for (int i = 0; i < cblGroup.Items.Count; i++)
     {
         if (cblGroup.Items[i].Selected)
         {
             var itemValue = cblGroup.Items[i].Value;
             oAttributeSettingsData.GroupId     = cblGroup.Items[i].Value.ToInt();
             oAttributeSettingsData.CreatedBy   = Session["LoggedUser"].ToString();
             oAttributeSettingsData.CreatedDate = System.DateTime.Now;
             oClient.CopyGroupsToNew(oAttributeSettingsData);
         }
     }
     FillLibraryAttributesGroups();
 }
Esempio n. 10
0
 private void FillLibraryAttributesGroups()
 {
     if (ViewState["LibraryId"] != null)
     {
         AttributeSettingsClient oClient = new AttributeSettingsClient(ServiceConfig.AttributeSettingsDataEndPoint(), ServiceConfig.AttributeSettingsDataUri());
         grdLibAttributesGroups.DataSource = oClient.GetAttributeGroupByLibraryId(ViewState["LibraryId"].ToString().ToInt());
         grdLibAttributesGroups.DataBind();
     }
 }
Esempio n. 11
0
 private void BindAttributes()
 {
     AttributeService.AttributeSettingsClient oClient = new AttributeService.AttributeSettingsClient(ServiceConfig.AttributeSettingsDataEndPoint(), ServiceConfig.AttributeSettingsDataUri());
     lstAllAttribute.DataSource     = oClient.GetGroupAttributes(0, ViewState["LibraryId"] == null ? 0 : Convert.ToInt32(ViewState["LibraryId"].ToString().ToInt()), "A");
     lstAllAttribute.DataTextField  = "AttributeName";
     lstAllAttribute.DataValueField = "AttributeId";
     lstAllAttribute.DataBind();
 }
Esempio n. 12
0
        private void FillAttributesForEdit(string AttributeId)
        {
            FillStyle(ddlStyle);
            AttributeService.AttributeSettingsClient oClient = new AttributeService.AttributeSettingsClient(ServiceConfig.AttributeSettingsDataEndPoint(), ServiceConfig.AttributeSettingsDataUri());
            AttributeService.AttributeSettingsData   oAttributeSettingsData    = new AttributeSettingsData();
            List <AttributeSettingsData>             AttributeSettingsDataTemp = new List <AttributeSettingsData>();

            AttributeSettingsDataTemp = oClient.GetAttributeListById(AttributeId);
            if (AttributeSettingsDataTemp.Count > 0)
            {
                txtAttributeName.Text = AttributeSettingsDataTemp[0].AttributeName;
                ddlAttributeType.SelectedItem.Text = AttributeSettingsDataTemp[0].AttributeType;
                chkAttributeStatus.Checked         = AttributeSettingsDataTemp[0].AttributeStatus;
                txtDescription.Text    = AttributeSettingsDataTemp[0].Description;
                ddlStyle.SelectedValue = AttributeSettingsDataTemp[0].StyleVal;
                if (AttributeSettingsDataTemp[0].DefaultValFlag)
                {
                    chkDefault.Checked   = true;
                    txtDefaultValue.Text = AttributeSettingsDataTemp[0].DefaultVal;
                }
                else
                {
                    chkDefault.Checked    = false;
                    DivdefaultVal.Visible = false;
                }
                if (AttributeSettingsDataTemp[0].IsValueMandatory)
                {
                    chkValMan.Checked = true;
                }
                if (AttributeSettingsDataTemp[0].IsInhMandatory)
                {
                    chkInhMand.Checked = true;
                }
                string a = string.Empty;
                AttributeService.AttributeSettingsClient oClientd = new AttributeService.AttributeSettingsClient(ServiceConfig.AttributeSettingsDataEndPoint(), ServiceConfig.AttributeSettingsDataUri());
                AttributeService.AttributeSettingsData   oAttributeSettingsDatad       = new AttributeSettingsData();
                List <AttributeSettingsData>             AttributeSettingsDataTempList = new List <AttributeSettingsData>();
                AttributeSettingsDataTempList = oClient.GetAttributesListValues(AttributeId.ToInt());
                if (AttributeSettingsDataTempList.Count > 0)
                {
                    string strText = string.Empty;
                    for (int i = 0; i < AttributeSettingsDataTempList.Count; i++)
                    {
                        strText += AttributeSettingsDataTempList[i].ListVal + "\n";
                    }
                    txtListValues.Text    = strText;
                    listVal.Visible       = true;
                    txtListValues.Visible = true;
                }
            }
        }
Esempio n. 13
0
        private void SaveListDetails(string inId)
        {
            AttributeService.AttributeSettingsClient oClient = new AttributeService.AttributeSettingsClient(ServiceConfig.AttributeSettingsDataEndPoint(), ServiceConfig.AttributeSettingsDataUri());
            AttributeService.AttributeSettingsData   oAttributeSettingsData = new AttributeSettingsData();
            oAttributeSettingsData.AttributeId = inId.ToInt();
            oClient.DeleteAttributeListVal(oAttributeSettingsData);
            string txt = txtListValues.Text;

            string[] lst = txt.Split(new Char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
            if (lst.Length > 0)
            {
                for (int i = 0; i < lst.Length - 1; i++)
                {
                    oAttributeSettingsData.ListVal   = lst[i];
                    oAttributeSettingsData.Updatedby = Session["LoggedUser"].ToString();
                    oClient.SaveAttributeListVal(oAttributeSettingsData);
                }
            }
        }
Esempio n. 14
0
        private void AttributeSaveOrEdit()
        {
            string strMsg, NewAttrId;

            AttributeService.AttributeSettingsClient oClient = new AttributeService.AttributeSettingsClient(ServiceConfig.AttributeSettingsDataEndPoint(), ServiceConfig.AttributeSettingsDataUri());
            AttributeService.AttributeSettingsData   oAttributeSettingsData = new AttributeSettingsData();
            oAttributeSettingsData.AttributeId   = ViewState["AttributeId"] == null ? 0 : Convert.ToInt16(ViewState["AttributeId"].ToString());
            oAttributeSettingsData.AttributeName = txtAttributeName.Text;
            oAttributeSettingsData.Style         = ddlStyle.SelectedValue;
            oAttributeSettingsData.Description   = txtAttrDescription.Text.Trim();
            string strTest = ddlAttributeType.SelectedItem.Text;

            string[] saTest = strTest.Split(' ');
            foreach (string strWord in saTest)
            {
                AttrType = (strWord.Substring(0, 1));
            }
            oAttributeSettingsData.AttributeType = AttrType;
            if (chkAttributeStatus.Checked == true)
            {
                oAttributeSettingsData.AttributeStatus = true;
            }
            else
            {
                oAttributeSettingsData.AttributeStatus = false;
            }
            if (chkDefault.Checked)
            {
                oAttributeSettingsData.DefaultValFlag = true;
                oAttributeSettingsData.DefaultVal     = txtDefaultValue.Text.Trim();
                if (txtDefaultValue.Text == string.Empty)
                {
                    string   txt = txtListValues.Text;
                    string[] lst = txt.Split(new Char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
                    if (lst.Length > 0)
                    {
                        oAttributeSettingsData.DefaultVal = lst[0];
                    }
                }
            }
            else
            {
                oAttributeSettingsData.DefaultValFlag = false;
                oAttributeSettingsData.DefaultVal     = string.Empty;
            }

            if (chkInhMand.Checked)
            {
                oAttributeSettingsData.IsInhMandatory = true;
            }
            else
            {
                oAttributeSettingsData.IsInhMandatory = false;
            }

            if (chkValMan.Checked)
            {
                oAttributeSettingsData.IsValueMandatory = true;
            }
            else
            {
                oAttributeSettingsData.IsValueMandatory = false;
            }
            oAttributeSettingsData.LibraryId   = ViewState["LibraryId"].ToString().ToInt();
            oAttributeSettingsData.CreatedBy   = Session["LoggedUser"].ToString();
            oAttributeSettingsData.CreatedDate = System.DateTime.Now;
            oAttributeSettingsData.Updatedby   = Session["LoggedUser"].ToString();
            oAttributeSettingsData.UpdatedDate = System.DateTime.Now;
            oAttributeSettingsData.User        = Session["LoggedUser"].ToString();
            strMsg = oClient.SaveAttribute(oAttributeSettingsData, out NewAttrId);
            if (listVal.Visible)
            {
                SaveListDetails(NewAttrId);
            }
            Common.SavedMessage(this, strMsg);
            FillLibraryAttributes();
        }
Esempio n. 15
0
 protected void grdAttribute_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Edit")
     {
         int         Index          = Convert.ToInt32(e.CommandArgument);
         Label       lblAttributeId = (Label)grdAttribute.Rows[Convert.ToInt32(e.CommandArgument)].FindControl("lblAttributeId");
         HiddenField hfLibraryId    = (HiddenField)grdAttribute.Rows[Convert.ToInt32(e.CommandArgument)].FindControl("hfLibraryId");
         ViewState["AttributeId"] = lblAttributeId.Text.Trim();
         ViewState["LibraryId"]   = hfLibraryId.Value;
         FillDetails();
     }
     if (e.CommandName == "Delete")
     {
         string      strMsg;
         int         index = Convert.ToInt32(e.CommandArgument);
         GridViewRow row   = grdAttribute.Rows[index];
         int         AttributeId;
         Label       lblAttributeIditem = (Label)grdAttribute.Rows[Convert.ToInt32(e.CommandArgument)].FindControl("lblAttributeId");
         AttributeId = Convert.ToInt16(lblAttributeIditem.Text);
         AttributeService.AttributeSettingsClient oClient = new AttributeService.AttributeSettingsClient(ServiceConfig.AttributeSettingsDataEndPoint(), ServiceConfig.AttributeSettingsDataUri());
         AttributeService.AttributeSettingsData   oData   = new AttributeService.AttributeSettingsData();
         oData.AttributeId = AttributeId;
         strMsg            = oClient.DeleteAttributeMaster(oData);
         SearchClear();
         Common.NotificationMessage(this, strMsg);
     }
 }
Esempio n. 16
0
        private void SearchGridFill()
        {
            AttributeSettingsClient oClient = new AttributeSettingsClient(ServiceConfig.AttributeSettingsDataEndPoint(), ServiceConfig.AttributeSettingsDataUri());

            grdAttribute.DataSource = oClient.GetFullAttributeList("A", txtSearch.Text.Trim());
            grdAttribute.DataBind();
        }