Beispiel #1
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 Page_Load(object sender, EventArgs e)
 {
     Page.Form.DefaultFocus  = TextBoxSearch.ClientID;
     Page.Form.DefaultButton = ButtonSearch.UniqueID;
     if (!IsPostBack)
     {
         string searchValue = "%";
         GridViewResult.DataSource = InsightSupplierContact.GetInsightSupplierContactListByFilter(searchValue);
         GridViewResult.DataBind();
     }
 }
        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;
            }
        }
 private void BindInsightSupplierContactGridView()
 {
     GridViewResult.DataSource = InsightSupplierContact.GetInsightSupplierContactListByInsightSupplierId(this.insightSupplierId);
     GridViewResult.DataBind();
 }
Beispiel #5
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 />");
                    }
                }
            }
        }
Beispiel #6
0
        private void BindInsightSupplierContact()
        {
            try
            {
                InsightSupplierContact insightSupplierContact = InsightSupplierContact.GetInsightSupplierContactByInsightSupplierContactId(this.insightSupplierContactId);
                //DropDownListAccount.Items.FindByValue(insightSupplierContact.AccountId.ToString()).Selected = true;
                TextBoxFirstName.Text = insightSupplierContact.FirstName;
                TextBoxLastName.Text  = insightSupplierContact.LastName;
                TextBoxLandline.Text  = insightSupplierContact.Landline;
                TextBoxMobile.Text    = insightSupplierContact.Mobile;
                TextBoxEmail.Text     = insightSupplierContact.Email;
                TextBoxAddress.Text   = insightSupplierContact.Address;
                DropDownListRegion.Items.FindByValue(insightSupplierContact.RegionId.ToString()).Selected             = true;
                DropDownListGift.Items.FindByValue(insightSupplierContact.Gift.ToString()).Selected                   = true;
                DropDownListAccessMethod.Items.FindByValue(insightSupplierContact.AccessMethodId.ToString()).Selected = true;
                TextBoxPosition.Text = insightSupplierContact.Position;

                InsightSupplierContactLicense insightSupplierContactLicenseISM = InsightSupplierContactLicense.GetInsightSupplierContactLicenseInSparMapperByInsightSupplierContactId(this.insightSupplierContactId);
                TextBoxInSparMapperUsername.Text = insightSupplierContactLicenseISM.InSparMapperUsername;
                TextBoxInSparMapperPassword.Text = insightSupplierContactLicenseISM.InSparMapperPassword;

                BindAccessMethodLayout();

                if (Convert.ToInt32(DropDownListAccessMethod.SelectedValue) == 1) //Online
                {
                    BindAccessMethodLayout();
                }
                else
                {
                    //DropDownListLicense.Items.FindByValue(insightSupplierContact.LicenseId.ToString()).Selected = true;
                    //DropDownListQlikviewVersion.Items.FindByValue(insightSupplierContact.QlikviewVersionId.ToString()).Selected = true;
                    BindLicenseGridView(this.insightSupplierContactId);

                    TextBoxUsername.Text = "";
                    TextBoxPassword.Text = "";
                }

                List <InsightSupplierContactDistributionLink> iscdlList = InsightSupplierContactDistributionLink.GetInsightSupplierContactDistributionLinkByInsightSupplierContactId(this.insightSupplierId, this.insightSupplierContactId);

                foreach (ListItem listItem in CheckBoxListLink.Items)
                {
                    foreach (InsightSupplierContactDistributionLink iscdl in iscdlList)
                    {
                        if (listItem.Value == iscdl.LinkId.ToString())
                        {
                            listItem.Selected = true;
                        }
                    }
                }

                List <InsightSupplierContactDistributionOption> iscdOList = InsightSupplierContactDistributionOption.GetInsightSupplierContactDistributionOptionByInsightSupplierContactId(this.insightSupplierId, this.insightSupplierContactId);

                foreach (ListItem listItem in CheckBoxListOption.Items)
                {
                    foreach (InsightSupplierContactDistributionOption iscdO in iscdOList)
                    {
                        if (listItem.Value == iscdO.OptionId.ToString())
                        {
                            listItem.Selected = true;
                        }
                    }
                }

                List <InsightSupplierContactDistributionModel> iscdMList = InsightSupplierContactDistributionModel.GetInsightSupplierContactDistributionModelByInsightSupplierContactId(this.insightSupplierId, this.insightSupplierContactId);

                foreach (ListItem listItem in CheckBoxListModel.Items)
                {
                    foreach (InsightSupplierContactDistributionModel iscdM in iscdMList)
                    {
                        if (listItem.Value == iscdM.ModelId.ToString())
                        {
                            listItem.Selected = true;
                        }
                    }
                }
            }
            catch (System.Data.SqlClient.SqlException sqlEx)
            {
                for (int i = 0; i < sqlEx.Errors.Count; i++)
                {
                    LabelError.Text += (sqlEx.Errors[i].Message + "<br />");
                }
                PanelError.Visible = true;
            }
            catch (Exception exception)
            {
                LabelError.Text   += (exception.Message + "<br />");
                PanelError.Visible = true;
            }
        }
 protected void ButtonSearch_Click(object sender, EventArgs e)
 {
     GridViewResult.DataSource = InsightSupplierContact.GetInsightSupplierContactListByFilter("%" + TextBoxSearch.Text + "%");
     GridViewResult.DataBind();
 }
 private void BindInsightSupplierContactGridView()
 {
     GridViewUser.DataSource = InsightSupplierContact.GetInsightSupplierContactListByInsightSupplierId(Convert.ToInt32(ViewState["InsightSupplierId"]));
     GridViewUser.DataBind();
 }