예제 #1
0
        public DC_Message AddUpdateProductInfo(MDMSVC.DC_Activity RQParams)
        {
            object result = null;

            ServiceConnection.MDMSvcProxy.PostData(ConfigurationManager.AppSettings["Activity_AddUpdateProductInfo"], RQParams, typeof(MDMSVC.DC_Activity), typeof(DC_Message), out result);
            return(result as DC_Message);
        }
        protected void frmProductInfo_ItemCommand(object sender, FormViewCommandEventArgs e)
        {
            TextBox      txtActivityID        = (TextBox)frmProductInfo.FindControl("txtActivityID");
            TextBox      txtProductName       = (TextBox)frmProductInfo.FindControl("txtProductName");
            TextBox      txtCommPID           = (TextBox)frmProductInfo.FindControl("txtCommPID");
            TextBox      txtCompanyProductID  = (TextBox)frmProductInfo.FindControl("txtCompanyProductID");
            TextBox      txtFinanceControlID  = (TextBox)frmProductInfo.FindControl("txtFinanceControlID");
            TextBox      txtDisplayName       = (TextBox)frmProductInfo.FindControl("txtDisplayName");
            DropDownList ddlProductCategory   = (DropDownList)frmProductInfo.FindControl("ddlProductCategory");
            DropDownList ddlProductCatSubType = (DropDownList)frmProductInfo.FindControl("ddlProductCatSubType");
            DropDownList ddlProductType       = (DropDownList)frmProductInfo.FindControl("ddlProductType");
            DropDownList ddlCountry           = (DropDownList)frmProductInfo.FindControl("ddlCountry");
            DropDownList ddlCity            = (DropDownList)frmProductInfo.FindControl("ddlCity");
            DropDownList ddlAffiliation     = (DropDownList)frmProductInfo.FindControl("ddlAffiliation");
            DropDownList ddlProductRating   = (DropDownList)frmProductInfo.FindControl("ddlProductRating");
            DropDownList ddlCompanyRating   = (DropDownList)frmProductInfo.FindControl("ddlCompanyRating");
            DropDownList ddlModeOfTransport = (DropDownList)frmProductInfo.FindControl("ddlModeOfTransport");

            dvMsg.Visible = true;


            if (e.CommandName.ToString() == "SaveProduct")
            {
                MDMSVC.DC_Activity _obj = new MDMSVC.DC_Activity();

                if (Request.QueryString["Activity_Id"] != null)
                {
                    _obj.Activity_Id = new Guid(txtActivityID.Text);
                    _obj.Edit_User   = System.Web.HttpContext.Current.User.Identity.Name;
                }
                else
                {
                    _obj.Create_User = System.Web.HttpContext.Current.User.Identity.Name;
                }
                if (txtProductName.Text != string.Empty)
                {
                    _obj.Product_Name = txtProductName.Text;
                }
                if (txtCommPID.Text != string.Empty)
                {
                    _obj.CommonProductID = Convert.ToInt32(txtCommPID.Text);
                }
                if (txtCompanyProductID.Text != string.Empty)
                {
                    _obj.CompanyProductID = Convert.ToInt32(txtCompanyProductID.Text);
                }
                if (txtFinanceControlID.Text != string.Empty)
                {
                    _obj.FinanceProductID = Convert.ToInt32(txtFinanceControlID.Text);
                }
                if (txtDisplayName.Text != string.Empty)
                {
                    _obj.Display_Name = txtDisplayName.Text;
                }
                if (ddlProductCategory.SelectedIndex != 0)
                {
                    _obj.ProductCategory = ddlProductCategory.SelectedItem.Text;
                }
                if (ddlProductCatSubType.SelectedIndex != 0)
                {
                    _obj.ProductCategorySubType = ddlProductCatSubType.SelectedItem.Text;
                }
                if (ddlProductType.SelectedIndex != 0)
                {
                    _obj.ProductType = ddlProductType.SelectedItem.Text;
                }
                if (ddlCountry.SelectedIndex != 0)
                {
                    _obj.Country    = ddlCountry.SelectedItem.Text;
                    _obj.Country_Id = Guid.Parse(ddlCountry.SelectedValue);
                }
                if (ddlCity.SelectedIndex != 0)
                {
                    _obj.City    = ddlCity.SelectedItem.Text;
                    _obj.City_Id = Guid.Parse(ddlCity.SelectedValue);
                }
                if (ddlAffiliation.SelectedIndex != 0)
                {
                    _obj.Affiliation = ddlAffiliation.SelectedItem.Text;
                }
                if (ddlProductRating.SelectedIndex != 0)
                {
                    _obj.ProductRating = Convert.ToInt32(ddlProductRating.SelectedItem.Text);
                }
                if (ddlCompanyRating.SelectedIndex != 0)
                {
                    _obj.CompanyRating = Convert.ToInt32(ddlCompanyRating.SelectedItem.Text);
                }
                if (ddlModeOfTransport.SelectedIndex != 0)
                {
                    _obj.Mode_Of_Transport = ddlModeOfTransport.SelectedItem.Text;
                }

                MDMSVC.DC_Message _msg = activitySVC.AddUpdateProductInfo(_obj);
                if (_msg.StatusCode == MDMSVC.ReadOnlyMessageStatusCode.Success)
                {
                    BootstrapAlert.BootstrapAlertMessage(dvMsg, _msg.StatusMessage, BootstrapAlertType.Success);
                }
                else if (_msg.StatusCode == MDMSVC.ReadOnlyMessageStatusCode.Duplicate)
                {
                    MDMSVC.DC_Activity_Search_RQ _objDup = new MDMSVC.DC_Activity_Search_RQ();
                    _objDup.Name = txtProductName.Text;
                    var res = activitySVC.ActivitySearch(_objDup);
                    if (res != null && res.Count != 0)
                    {
                        if (res.Count > 0)
                        {
                            grdSearchResults.VirtualItemCount = Convert.ToInt32(res[0].TotalRecord);
                            grdSearchResults.DataSource       = res;
                            grdSearchResults.PageIndex        = 0;
                            grdSearchResults.PageSize         = 1;
                            grdSearchResults.DataBind();
                            grdSearchResults.Visible = true;
                        }
                    }
                    else
                    {
                        grdSearchResults.DataSource = null;
                        grdSearchResults.DataBind();
                    }

                    dvMsg.Visible = true;
                    BootstrapAlert.BootstrapAlertMessage(dvMsg, _msg.StatusMessage, (BootstrapAlertType)_msg.StatusCode);
                }
                else
                {
                    dvMsg.Visible = true;
                    BootstrapAlert.BootstrapAlertMessage(dvMsg, _msg.StatusMessage, (BootstrapAlertType)_msg.StatusCode);
                }
                //frmVwNewActivity.ChangeMode(FormViewMode.Insert);
            }
        }