public static List <IfwdAgent> GetAgent(SearchCriteria searchCriteria, int ID) { string strExecution = "[fwd].[prcGetAgentList]"; List <IfwdAgent> lstAgent = new List <IfwdAgent>(); using (DbQuery oDq = new DbQuery(strExecution)) { oDq.AddIntegerParam("@AgentID", ID); oDq.AddVarcharParam("@SchAgentName", 100, searchCriteria.AgentName); oDq.AddVarcharParam("@SchLineName", 100, searchCriteria.LineName); oDq.AddVarcharParam("@SchFPOD", 100, searchCriteria.POD); oDq.AddVarcharParam("@SortExpression", 50, searchCriteria.SortExpression); oDq.AddVarcharParam("@SortDirection", 4, searchCriteria.SortDirection); DataTableReader reader = oDq.GetTableReader(); while (reader.Read()) { IfwdAgent oIH = new fwdAgentEntity(reader); lstAgent.Add(oIH); } reader.Close(); } return(lstAgent); }
private void LoadData() { fwdAgentEntity oAgent = (fwdAgentEntity)fwdAgentBLL.GetAgent(Convert.ToInt32(hdnAgentID.Value)); //ddlFromLocation.SelectedIndex = Convert.ToInt32(ddlFromLocation.Items.IndexOf(ddlFromLocation.Items.FindByValue(oImportHaulage.LocationFrom))); hdnFPOD.Value = oAgent.FPODID.ToString(); ddlLine.SelectedValue = oAgent.LinerID.ToString(); txtAddress.Text = Convert.ToString(oAgent.AgentAddress); txtContPerson.Text = Convert.ToString(oAgent.ContactPerson); txtPhone.Text = Convert.ToString(oAgent.Phone); txtEmail.Text = Convert.ToString(oAgent.email); txtFax.Text = Convert.ToString(oAgent.FAX); txtAgent.Text = Convert.ToString(oAgent.AgentName); txtFPOD.Text = Convert.ToString(oAgent.FPOD); hdnAgentID.Value = Convert.ToString(oAgent.AgentID); }
public static IfwdAgent GetAgent(int ID) { string strExecution = "[fwd].[prcGetAgentList]"; IfwdAgent oIH = null; using (DbQuery oDq = new DbQuery(strExecution)) { oDq.AddIntegerParam("@AgentID", ID); oDq.AddVarcharParam("@SortExpression", 30, ""); oDq.AddVarcharParam("@SortDirection", 4, ""); DataTableReader reader = oDq.GetTableReader(); while (reader.Read()) { oIH = new fwdAgentEntity(reader); } reader.Close(); } return(oIH); }
protected void btnSave_Click(object sender, EventArgs e) { if (Page.IsValid) { //if (Convert.ToDecimal(txtWFrom.Text) > Convert.ToDecimal(txtWTo.Text)) //{ // ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "<script>javascript:void alert('" + ResourceManager.GetStringWithoutName("ERR00077") + "');</script>", false); // return; //} oAgentBll = new fwdAgentBLL(); oAgentEntity = new fwdAgentEntity(); //oUserEntity = (UserEntity)Session[Constants.SESSION_USER_INFO]; // This section has been commented temporarily oAgentEntity.LinerID = ddlLine.SelectedValue.ToInt(); oAgentEntity.FPODID = hdnFPOD.Value; oAgentEntity.AgentAddress = txtAddress.Text.ToString(); oAgentEntity.AgentName = Convert.ToString(txtAgent.Text.Trim()); oAgentEntity.ContactPerson = Convert.ToString(txtContPerson.Text.Trim()); oAgentEntity.AgentStatus = true; oAgentEntity.Phone = Convert.ToString(txtPhone.Text); oAgentEntity.FAX = Convert.ToString(txtFax.Text); oAgentEntity.email = Convert.ToString(txtEmail.Text); if (hdnAgentID.Value == "0") // Insert { oAgentEntity.CreatedBy = _userId; // oUserEntity.Id; oAgentEntity.CreatedOn = DateTime.Today.Date; oAgentEntity.ModifiedBy = _userId; // oUserEntity.Id; oAgentEntity.ModifiedOn = DateTime.Today.Date; switch (oAgentBll.AddEditAgent(oAgentEntity, _CompanyId)) { case -1: lblMessage.Text = ResourceManager.GetStringWithoutName("ERR00076"); break; case 0: lblMessage.Text = ResourceManager.GetStringWithoutName("ERR00011"); ClearAll(); break; case 1: lblMessage.Text = ResourceManager.GetStringWithoutName("ERR00009"); ClearAll(); break; } } else // Update { oAgentEntity.AgentID = Convert.ToInt32(hdnAgentID.Value); oAgentEntity.ModifiedBy = _userId;// oUserEntity.Id; oAgentEntity.ModifiedOn = DateTime.Today.Date; oAgentEntity.Action = true; // switch (oAgentBll.AddEditAgent(oAgentEntity, _CompanyId)) { case -1: lblMessage.Text = ResourceManager.GetStringWithoutName("ERR00076"); break; case 0: lblMessage.Text = ResourceManager.GetStringWithoutName("ERR00011"); break; case 1: Response.Redirect("~/Forwarding/Master/ManageFwdAgent.aspx"); break; } } } }