protected void pageSave(Object sender, BrilliantWMS.ToolbarService.iUCToolbarClient e) { iCompanySetupClient CompanyClient = new iCompanySetupClient(); try { CustomProfile profile = CustomProfile.GetProfile(); mChannel Channel = new mChannel(); if (hdnState.Value == "Edit") { Channel = CompanyClient.GetChannelByChanID(long.Parse(hdnselectedchanID.Value), profile.DBConnection._constr); } Channel.ChannelName = txtchannelname.Text; Channel.ChannelURL = txtchanlUrl.Text; Channel.UserName = txtusername.Text; Channel.Password = txtpassword.Text; Channel.TypeID = long.Parse(ddlchantype.SelectedItem.Value); if (hdnchannelid.Value != "") { Channel.StandardChannelID = long.Parse(hdnchannelid.Value); } if (hndCompanyid.Value != "") { Channel.CompanyID = long.Parse(hndCompanyid.Value); } Channel.CustomerID = long.Parse(hdncustomerid.Value); Channel.Active = "Yes"; if (rbtnActiveYes.Checked != true) { Channel.Active = "No"; } if (hdnState.Value == "Edit") { Channel.ModifiedBy = profile.Personal.UserID; Channel.ModifiedDate = DateTime.Today; long channelid = CompanyClient.SaveChannelDetail(Channel, profile.DBConnection._constr); } else { Channel.CreatedBy = profile.Personal.UserID; Channel.CreationDate = DateTime.Now; long channelid = CompanyClient.SaveChannelDetail(Channel, profile.DBConnection._constr); } WebMsgBox.MsgBox.Show("Record saved successfully"); WarehouseGridBind(); clear(); setActiveTab(0); } catch (System.Exception ex) { Login.Profile.ErrorHandling(ex, this, "Channel Master", "Save"); } finally { CompanyClient.Close(); } }
public void GetChannelForEdit(long channelID) { iCompanySetupClient CompanyClient = new iCompanySetupClient(); CustomProfile profile = CustomProfile.GetProfile(); try { mChannel chan = new mChannel(); chan = CompanyClient.GetChannelByChanID(channelID, profile.DBConnection._constr); if (chan.ChannelName != null) { txtchannelname.Text = chan.ChannelName.ToString(); } if (chan.ChannelURL != null) { txtchanlUrl.Text = chan.ChannelURL.ToString(); } if (chan.UserName != null) { txtusername.Text = chan.UserName.ToString(); } if (chan.Password != null) { txtpassword.Text = chan.Password.ToString(); } txtpassword.Attributes["value"] = chan.Password.ToString(); if (chan.Active == "No") { rbtnActiveNo.Checked = true; } FillCompany(); if (chan.CompanyID != null) { ddlcompany.SelectedIndex = ddlcompany.Items.IndexOf(ddlcompany.Items.FindByValue(chan.CompanyID.ToString())); } hndCompanyid.Value = chan.CompanyID.ToString(); getCustomer(long.Parse(chan.CompanyID.ToString())); if (chan.CustomerID != null) { ddlcutomer.SelectedIndex = ddlcutomer.Items.IndexOf(ddlcutomer.Items.FindByValue(chan.CustomerID.ToString())); } hdncustomerid.Value = chan.CustomerID.ToString(); // if (chan.TypeID != null) ddlchantype.SelectedIndex = ddlcutomer.Items.IndexOf(ddlchantype.Items.FindByValue(chan.TypeID.ToString())); if (chan.TypeID != null) { ddlchantype.SelectedItem.Value = chan.TypeID.ToString(); } ddlchantype.SelectedValue = chan.TypeID.ToString(); if (chan.TypeID.ToString() == "1") { ddlchantype.SelectedIndex = 1; } else if (chan.TypeID.ToString() == "2") { ddlchantype.SelectedIndex = 2; } if (chan.TypeID.ToString() == "1") { GetChannelByType(); if (chan.StandardChannelID != null) { ddlchannel.SelectedIndex = ddlchannel.Items.IndexOf(ddlchannel.Items.FindByValue(chan.StandardChannelID.ToString())); } } else { ddlchannel.Enabled = false; } } catch (Exception ex) { Login.Profile.ErrorHandling(ex, this, "Channel Master", "GetChannelForEdit"); } finally { CompanyClient.Close(); } }