protected void GridViewResult_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                switch (e.CommandName.ToLower())
                {
                case "removeinsightsuppliercontactlink":
                {
                    InsightSupplierContactLink.DeleteInsightSupplierContactLinkByInsightSupplierContactLinkId(Convert.ToInt32(e.CommandArgument));

                    BindInsightSupplierContactList();
                    BindInsightSupplierContactGridView();

                    break;
                }
                }
            }
            catch (System.Data.SqlClient.SqlException sqlEx)
            {
                LabelError.Text = "";
                for (int i = 0; i < sqlEx.Errors.Count; i++)
                {
                    LabelError.Text += (sqlEx.Errors[i].Message + "<br />");
                }
                PanelError.Visible = true;
            }
        }
        protected void GridViewResult_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                switch (e.CommandName.ToLower())
                {
                case "removeinsightsupplier":
                {
                    int insightSupplierId = Convert.ToInt32(e.CommandArgument);

                    InsightSupplierCustomHeader.DeleteInsightSupplierCustomHeaderByInsightSupplierId(insightSupplierId);
                    InsightSupplierContactDistributionLink.DeleteInsightSupplierContactDistributionLinkByInsightSupplierId(insightSupplierId);
                    InsightSupplierContactDistributionOption.DeleteInsightSupplierContactDistributionOptionByInsightSupplierId(insightSupplierId);
                    InsightSupplierContactDistributionModel.DeleteInsightSupplierContactDistributionModelByInsightSupplierId(insightSupplierId);
                    InsightSupplierContactLicense.DeleteInsightSupplierContactLicenseByInsightSupplierId(insightSupplierId);
                    InsightSupplierContactLink.DeleteInsightSupplierContactLinkByInsightSupplierId(insightSupplierId);
                    InsightSupplierMerchandising.DeleteInsightSupplierMerchandisingByInsightSupplierId(insightSupplierId);
                    InsightSupplierMerchSupplierLink.DeleteInsightSupplierMerchSupplierLinkByInsightSupplierId(insightSupplierId);
                    InsightSupplier.DeleteInsightSupplierByInsightSupplierId(insightSupplierId);

                    BindGridViewResultDefault();

                    break;
                }
                }
            }
            catch (System.Data.SqlClient.SqlException sqlEx)
            {
            }
        }
Esempio n. 3
0
        protected void GridViewResult_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                switch (e.CommandName.ToLower())
                {
                case "removeinsightsuppliercontactlink":
                {
                    string[] commandArgs = e.CommandArgument.ToString().Split(new char[] { ',' });
                    int      insightSupplierContactLinkId    = Convert.ToInt32(commandArgs[0]);
                    int      insightSupplierContactLicenseId = Convert.ToInt32(commandArgs[1]);

                    int insightSupplierContactIdSelectedUser = InsightSupplierContact.GetInsightSupplierContactByInsightSupplierContactLinkId(insightSupplierContactLinkId).InsightSupplierContactId;

                    InsightSupplierContactDistributionLink.DeleteInsightSupplierContactDistributionLinkByInsightSupplierContactId(this.insightSupplierId, insightSupplierContactIdSelectedUser);
                    InsightSupplierContactDistributionOption.DeleteInsightSupplierContactDistributionOptionByInsightSupplierContactId(this.insightSupplierId, insightSupplierContactIdSelectedUser);
                    InsightSupplierContactDistributionModel.DeleteInsightSupplierContactDistributionModelByInsightSupplierContactId(this.insightSupplierId, insightSupplierContactIdSelectedUser);

                    InsightSupplierContactLicense.DeleteInsightSupplierContactLicenseByInsightSupplierContactIdInsightSupplierId(this.insightSupplierId, insightSupplierContactIdSelectedUser);

                    InsightSupplierContactLink.DeleteInsightSupplierContactLinkByInsightSupplierContactLinkId(insightSupplierContactLinkId);

                    //InsightSupplierContactLink.DeleteInsightSupplierContactLinkByInsightSupplierContactLinkId(Convert.ToInt32(e.CommandArgument));
                    BindInsightSupplierContactGridView();

                    TextBoxFirstName.Text = "";
                    TextBoxLastName.Text  = "";
                    TextBoxPosition.Text  = "";
                    TextBoxLandline.Text  = "";
                    TextBoxMobile.Text    = "";
                    TextBoxEmail.Text     = "";
                    TextBoxAddress.Text   = "";
                    TextBoxUsername.Text  = "";
                    TextBoxPassword.Text  = "";

                    BindRegion();
                    BindGift();
                    BindModel();
                    BindOption();
                    BindLink();
                    BindAccessMethod();
                    BindLicense();
                    BindQlikviewVersion();
                    PanelInstall.Visible = false;
                    PanelOnline.Visible  = false;

                    break;
                }
                }
            }
            catch (System.Data.SqlClient.SqlException sqlEx)
            {
                LabelError.Text = "";
                for (int i = 0; i < sqlEx.Errors.Count; i++)
                {
                    LabelError.Text += (sqlEx.Errors[i].Message + "<br />");
                }
                PanelError.Visible = true;
            }
        }
        protected void ButtonAddInsightSupplierContactLink_Click(object sender, EventArgs e)
        {
            InsightSupplierContactLink insightSupplierContactLink = new InsightSupplierContactLink();

            insightSupplierContactLink.InsightSupplierContactId = Convert.ToInt32(DropDownListInsightSupplierContact.SelectedValue);
            insightSupplierContactLink.InsightSupplierId        = this.insightSupplierId;
            insightSupplierContactLink.ModifiedUser             = Context.User.Identity.GetUserName();
            insightSupplierContactLink.Save();

            BindInsightSupplierContactList();
            BindInsightSupplierContactGridView();
        }
        protected void GridViewUser_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                switch (e.CommandName.ToLower())
                {
                case "removeinsightsuppliercontactlink":
                {
                    string[] commandArgs = e.CommandArgument.ToString().Split(new char[] { ',' });
                    int      insightSupplierContactLinkId    = Convert.ToInt32(commandArgs[0]);
                    int      insightSupplierContactLicenseId = Convert.ToInt32(commandArgs[1]);

                    int insightSupplierContactId = InsightSupplierContact.GetInsightSupplierContactByInsightSupplierContactLinkId(insightSupplierContactLinkId).InsightSupplierContactId;

                    InsightSupplierContactDistributionLink.DeleteInsightSupplierContactDistributionLinkByInsightSupplierContactId(this.insightSupplierId, insightSupplierContactId);
                    InsightSupplierContactDistributionOption.DeleteInsightSupplierContactDistributionOptionByInsightSupplierContactId(this.insightSupplierId, insightSupplierContactId);
                    InsightSupplierContactDistributionModel.DeleteInsightSupplierContactDistributionModelByInsightSupplierContactId(this.insightSupplierId, insightSupplierContactId);

                    //InsightSupplierContactLicense.DeleteInsightSupplierContactLicenseByInsightSupplierContactLicenseId(insightSupplierContactLicenseId);
                    InsightSupplierContactLicense.DeleteInsightSupplierContactLicenseByInsightSupplierContactIdInsightSupplierId(this.insightSupplierId, insightSupplierContactId);

                    InsightSupplierContactLink.DeleteInsightSupplierContactLinkByInsightSupplierContactLinkId(insightSupplierContactLinkId);

                    //InsightSupplierContactLink.DeleteInsightSupplierContactLinkByInsightSupplierContactLinkId(Convert.ToInt32(e.CommandArgument));

                    BindInsightSupplierContactList();
                    BindInsightSupplierContactGridView();

                    break;
                }
                }
            }
            catch (System.Data.SqlClient.SqlException sqlEx)
            {
                LabelError.Text = "";
                for (int i = 0; i < sqlEx.Errors.Count; i++)
                {
                    LabelError.Text += (sqlEx.Errors[i].Message + "<br />");
                }
                PanelError.Visible = true;
            }
        }
Esempio n. 6
0
        protected void ButtonSave_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                InsightSupplierContact insightSupplierContact = new InsightSupplierContact();
                insightSupplierContact.InsightSupplierContactId = this.insightSupplierContactId;
                //insightSupplierContact.AccountId = Convert.ToInt32(DropDownListAccount.SelectedValue);
                insightSupplierContact.FirstName      = TextBoxFirstName.Text;
                insightSupplierContact.LastName       = TextBoxLastName.Text;
                insightSupplierContact.Landline       = TextBoxLandline.Text;
                insightSupplierContact.Mobile         = (TextBoxMobile.Text.Length == 0) ? "" : TextBoxMobile.Text;
                insightSupplierContact.Email          = (TextBoxEmail.Text.Length == 0) ? "" : TextBoxEmail.Text;
                insightSupplierContact.Address        = (TextBoxAddress.Text.Length == 0) ? "" : TextBoxAddress.Text;
                insightSupplierContact.RegionId       = Convert.ToInt32(DropDownListRegion.SelectedValue);
                insightSupplierContact.Gift           = Convert.ToInt32(DropDownListGift.SelectedValue);
                insightSupplierContact.AccessMethodId = Convert.ToInt32(DropDownListAccessMethod.SelectedValue);
                insightSupplierContact.Position       = (TextBoxPosition.Text.Length == 0) ? "" : TextBoxPosition.Text;
                insightSupplierContact.ModifiedUser   = Context.User.Identity.GetUserName();

                try
                {
                    insightSupplierContact.Save();
                    int insightSupplierContactId = insightSupplierContact.InsightSupplierContactId;

                    InsightSupplierContactLicense insightSupplierContactLicenseRow = InsightSupplierContactLicense.GetInsightSupplierContactLicenseByInsightSupplierContactIdAccessMethodId(insightSupplierContact.InsightSupplierContactId, Convert.ToInt32(DropDownListAccessMethod.SelectedValue));

                    if (Convert.ToInt32(DropDownListAccessMethod.SelectedValue) == 1) //Online
                    {
                        InsightSupplierContactLicense insightSupplierContactLicense = new InsightSupplierContactLicense();
                        insightSupplierContactLicense.InsightSupplierContactLicenseId = insightSupplierContactLicenseRow.InsightSupplierContactLicenseId;
                        insightSupplierContactLicense.InsightSupplierContactId        = insightSupplierContact.InsightSupplierContactId;
                        insightSupplierContactLicense.AccessMethodId    = Convert.ToInt32(DropDownListAccessMethod.SelectedValue);
                        insightSupplierContactLicense.Username          = TextBoxUsername.Text;
                        insightSupplierContactLicense.Password          = TextBoxPassword.Text;
                        insightSupplierContactLicense.LicenseId         = 0;
                        insightSupplierContactLicense.QlikviewVersionId = 0;
                        insightSupplierContactLicense.ModifiedUser      = Context.User.Identity.GetUserName();
                        insightSupplierContactLicense.Save();

                        BindLicenseGridView(insightSupplierContact.InsightSupplierContactId);
                    }

                    //InsightSupplierContactLicense.UpdateInsightSupplierContactLicenseInSparMapperByInsightSupplierContactLicenseId(insightSupplierContactLicenseRow.InsightSupplierContactLicenseId, (TextBoxInSparMapperUsername.Text.Length > 0) ? TextBoxInSparMapperUsername.Text : "", (TextBoxInSparMapperPassword.Text.Length > 0) ? TextBoxInSparMapperPassword.Text : "", Context.User.Identity.GetUserName());
                    InsightSupplierContactLicense.UpdateInsightSupplierContactLicenseInSparMapperByInsightSupplierContactId(insightSupplierContact.InsightSupplierContactId, (TextBoxInSparMapperUsername.Text.Length > 0) ? TextBoxInSparMapperUsername.Text : "", (TextBoxInSparMapperPassword.Text.Length > 0) ? TextBoxInSparMapperPassword.Text : "", Context.User.Identity.GetUserName());

                    if (this.insightSupplierId != 0)
                    {
                        InsightSupplierContactLink insightSupplierContactLink = new InsightSupplierContactLink();
                        insightSupplierContactLink.InsightSupplierContactId = insightSupplierContact.InsightSupplierContactId;
                        insightSupplierContactLink.InsightSupplierId        = this.insightSupplierId;
                        insightSupplierContactLink.ModifiedUser             = Context.User.Identity.GetUserName();
                        insightSupplierContactLink.Save();

                        BindInsightSupplierContactGridView();
                    }

                    if (insightSupplierContactId != 0)
                    {
                        SaveInsightSupplierContactDistributionLink(insightSupplierContactId);
                    }

                    if (insightSupplierContactId != 0)
                    {
                        SaveInsightSupplierContactDistributionOption(insightSupplierContactId);
                    }

                    if (insightSupplierContactId != 0)
                    {
                        SaveInsightSupplierContactDistributionModel(insightSupplierContactId);
                    }

                    Button clickedButton = (Button)sender;
                    switch (clickedButton.ID)
                    {
                    case "ButtonSave":
                        Response.Redirect("InsightSupplierContactList.aspx");
                        break;

                    case "ButtonSaveEdit":
                        Response.Redirect(String.Format("InsightSupplierContactEdit.aspx?InsightSupplierContactId={0}&InsightSupplierId={1}", insightSupplierContact.InsightSupplierContactId, this.insightSupplierId));
                        break;

                    case "ButtonSaveNew":
                        Response.Redirect("InsightSupplierContactEdit.aspx");
                        break;

                    case "ButtonSaveLink":
                        Response.Redirect(String.Format("InsightSupplierContactEdit.aspx?InsightSupplierContactId={0}&InsightSupplierId={1}", 0, this.insightSupplierId));
                        break;
                    }
                }
                catch (System.Data.SqlClient.SqlException sqlEx)
                {
                    LabelError.Text = "";
                    for (int i = 0; i < sqlEx.Errors.Count; i++)
                    {
                        ErrorMessage.Text += (sqlEx.Errors[i].Message + "<br />");
                    }
                }
            }
        }