示例#1
0
    protected void txtDocNoGet_TextChanged(object sender, EventArgs e)
    {
        {
            try
            {
                string  DocNo = txtDocNoGet.Text;
                DataSet Ds    = new DataSet();
                Ds = CourierDetails.GetCourierValidation("DocNoCourier", DocNo);

                if (Ds.Tables[0].Rows.Count != 0)
                {
                    MessageBox("Courier Id is Already Created   " + Ds.Tables[0].Rows[0]["SCMasterAutoId"].ToString());
                    txtDocNoGet.Text = "";
                    txtDocNoGet.Focus();
                }
                else
                {
                    txtDocNoGet.Focus();
                }
            }
            catch
            {
            }
        }
    }
示例#2
0
    protected void btnGeneralSave_Click(object sender, EventArgs e)
    {
        int SCD;

        try
        {
            CourierDetails _objCD = new CourierDetails();
            _objCD.Save(Convert.ToString(ViewState["DocNo"]), "General", Convert.ToInt16(strFY), Convert.ToInt16(ddlCourier.SelectedValue.ToString()), Convert.ToInt16(ddlBranch.SelectedValue.ToString()), txtAddress.Text.ToString(), txtDepartment.Text.ToString(), txtAddressGeneral.Text.ToString(), txtRemark.Text.ToString(), Convert.ToString(Session["UserName"]), out SCD);
            MessageBox("Record saved successfully");
            ViewState["SCD"] = ViewState["SCD"] + "," + SCD + ",";
            string mSCD = ViewState["SCD"].ToString();
            //if (mSCD != null)
            //{
            //    mSCD = mSCD.Substring(0, mSCD.Length - 1);

            //}

            DataTable Ds = new DataTable();
            Ds = CourierDetails.Get_CourierDetailsGeneral(mSCD, "GeneralGrid", Convert.ToInt32(strFY)).Tables[0];
            //Ds = CourierDetails.Get_CourierDetailsCheckSave(Convert.ToString(ViewState["DocNo"]), "InvoiceNoGrid", Convert.ToInt16(ddlCourier.SelectedValue.ToString()), Convert.ToInt16(ddlBranch.SelectedValue.ToString()), Convert.ToInt32(strFY)).Tables[0];

            grdGeneral.DataSource = Ds;
            grdGeneral.DataBind();
            SaveGeneral.Visible = true;
            txtDepartment.Text  = "";
            txtRemark.Text      = "";
            //txtAddress.Text = "";
            txtAddressGeneral.Text = "";
            //Branch();
            //Courier();
            divLevel4.Visible     = true;
            divgrdGeneral.Visible = true;
        }
        catch { }
    }
示例#3
0
    protected void txtInvoiceNoGet_TextChanged(object sender, EventArgs e)
    {
        {
            try
            {
                string  Invoice = txtInvoiceNoGet.Text;
                DataSet Ds      = new DataSet();
                Ds = CourierDetails.GetCourierValidation("InvoiceCourier", Invoice);

                if (Ds.Tables[0].Rows.Count != 0)
                {
                    MessageBox("Courier is already generated for this invoce no is  " + Ds.Tables[0].Rows[0]["SCMasterAutoId"].ToString() + " Do you want to create it again ?");
                    //txtInvoiceNoGet.Text = "";
                    txtInvoiceNoGet.Focus();
                }
                else
                {
                    txtInvoiceNoGet.Focus();
                }
            }
            catch
            {
            }
        }
    }
示例#4
0
    protected void ddlBranch_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (ddlBranch.SelectedValue.ToString() != "0")
        {
            trBranchAddress.Visible = true;
            DataSet Ds = new DataSet();
            Ds = CourierDetails.GetCourierBranch(Convert.ToInt16(ddlBranch.SelectedValue.ToString()), "BranchAddress");

            if (Ds.Tables[0].Rows[0]["Address"].ToString() != "")
            {
                txtAddress.Text          = Ds.Tables[0].Rows[0]["Address"].ToString();
                trAddressGeneral.Visible = false;
                txtAddressGeneral.Text   = "";
            }
            else
            {
                trAddressGeneral.Visible = false;
                txtAddressGeneral.Text   = "";
                MessageBox("Address not specified for " + ddlBranch.SelectedItem.Text.ToString() + " branch");
            }
        }
        else
        {
            trBranchAddress.Visible  = false;
            txtAddress.Text          = "";
            trAddressGeneral.Visible = true;
        }
    }
    protected void gdGeneral_RowEditing(object sender, GridViewEditEventArgs e)
    {
        divEdit.Visible = true;
        try
        {
            lblSCDetailAutoId.Text = ((Label)gdGeneral.Rows[e.NewEditIndex].FindControl("lblSCDetailAutoId")).Text;

            ddlCourierEdit.SelectedValue = ((Label)gdGeneral.Rows[e.NewEditIndex].FindControl("lblAutoId")).Text;
            ddlBranchEdit.SelectedValue  = ((Label)gdGeneral.Rows[e.NewEditIndex].FindControl("lblEmpID")).Text;
            txt_remark.Text = ((Label)gdGeneral.Rows[e.NewEditIndex].FindControl("lblRemark1")).Text;
            txtdept.Text    = ((Label)gdGeneral.Rows[e.NewEditIndex].FindControl("lblDepartment")).Text;
            if (ddlBranchEdit.SelectedValue != "0")
            {
                DataSet Ds = new DataSet();
                Ds = CourierDetails.GetCourierBranch(Convert.ToInt16(ddlBranchEdit.SelectedValue.ToString()), "BranchAddress");


                txtAddressEdit.Text = Ds.Tables[0].Rows[0]["Address"].ToString();
                Ds.Dispose();
                trBranchAddress.Visible      = true;
                trAddressGeneralEdit.Visible = false;
            }
            else
            {
                trAddressGeneralEdit.Visible = true;
                trBranchAddress.Visible      = false;
            }
        }
        catch
        {
        }
    }
        public async Task <string> ParcelPickup(ParcelPickupRequest request, CourierDetails courierDetails)
        {
            var token = await authService.GetToken();

            httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {token}");
            httpClient.DefaultRequestHeaders.Add("user_name", courierDetails.Username);

            var uriBuilder  = new UriBuilder(courierSettings.ParcelPickupUrl);
            var jsonRequest = JsonConvert.SerializeObject(request, Formatting.None, serializerSettings);
            var jsonContent = new StringContent(jsonRequest, Encoding.UTF8, "application/json");
            var response    = await httpClient.PostAsync(uriBuilder.Uri, jsonContent);

            var result   = response.Content.ReadAsStringAsync().Result;
            var contract = JsonConvert.DeserializeObject <ParcelPickupResponseContract>(result, serializerSettings);

            if (!response.IsSuccessStatusCode || string.IsNullOrEmpty(contract.Results.JobNumber))
            {
                logger.LogError($"Unsuccessful Parcel Pickup response: {response.StatusCode}");

                if (contract.Errors != null && contract.Errors.Count != 0)
                {
                    throw new ServiceException(response.StatusCode, $"Parcel Pickup Error - {contract.Errors[0].Details}");
                }
                else
                {
                    throw new ServiceException(response.StatusCode, $"Parcel Pickup Status Code: {response.StatusCode}");
                }
            }

            logger.LogDebug($"Parcel Pickup Job_Number:{contract.Results.JobNumber}");

            return(contract.Results.JobNumber);
        }
示例#7
0
    protected void RepDetailsConfirm_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        TextBox txtPODId          = null;
        Label   lblSCMasterAutoId = null;
        Label   lblDocumentNo     = null;
        Label   lblInvoiceNo      = null;

        txtPODId          = (TextBox)e.Item.FindControl("txtPODId");
        lblSCMasterAutoId = (Label)e.Item.FindControl("lblSCMasterAutoId");
        lblDocumentNo     = (Label)e.Item.FindControl("lblDocumentNo");
        lblInvoiceNo      = (Label)e.Item.FindControl("lblInvoiceNo");

        Label    lblCustName = (Label)e.Item.FindControl("lblCustName");
        GridView grdView     = (GridView)e.Item.FindControl("grdCD");

        ViewState["DocNo"] = ViewState["DocNo"] + "," + txtDocNoGet.Text + ",";
        DataSet Ds = new DataSet();

        if (txtCourierId.Text.ToString() != "")
        {
            Ds = CourierDetails.UpdatePOD(float.Parse(txtCourierId.Text), "CourierId", Convert.ToInt32(strFY));
        }
        else if (txtInvoiceNoGet.Text.ToString() != "")
        {
            Ds = CourierDetails.UpdatePOD(float.Parse(txtInvoiceNoGet.Text), "Invoice", Convert.ToInt32(strFY));
        }
        else if (txtDocNoGet.Text.ToString() != "")
        {
            Ds = CourierDetails.UpdatePOD(float.Parse(txtDocNoGet.Text), "DocNo", Convert.ToInt32(strFY));
        }
        DataView dv = new DataView(Ds.Tables[0]);

        grdView.DataSource = dv;
        grdView.DataBind();
    }
    protected void Save_Click(object sender, EventArgs e)
    {
        try
        {
            CourierDetails _objCD = new CourierDetails();
            _objCD.SaveDispatchEmailDetails(Convert.ToInt32(txtDocIdEdit.Text.Trim()), "O", Convert.ToInt32(strFY), Convert.ToString(Session["UserName"]), out SCD);

            SendEmailJob();
        }
        catch { }
    }
示例#9
0
    protected void btn_Save_Click(object sender, EventArgs e)
    {
        btnSave.Visible        = true;
        PnlSendCourier.Visible = false;
        ViewState["DocNo"]     = ViewState["DocNo"] + "," + lblDocumentNo.Text + ",";
        DataTable Ds = new DataTable();

        Ds = CourierDetails.Get_CourierDetailsCheck(Convert.ToString(ViewState["DocNo"]), "DocNoGrid", Convert.ToInt32(strFY)).Tables[0];
        grdCD.DataSource = Ds;
        grdCD.DataBind();
    }
 public void Courier()
 {
     if (rdLevel1.SelectedValue == "InvoiceNo")
     {
         ddlCourierI.DataSource = CourierDetails.GetCourier("Courier");
         ddlCourierI.DataBind();
         ddlCourierI.Items.Insert(0, new ListItem("--Select Courier Company--", "0"));
     }
     else if (rdLevel1.SelectedValue == "Others")
     {
         ddlCourier.DataSource = CourierDetails.GetCourier("Courier");
         ddlCourier.DataBind();
         ddlCourier.Items.Insert(0, new ListItem("--Select Courier Company--", "0"));
     }
 }
 public void Branch()
 {
     if (rdLevel1.SelectedValue == "InvoiceNo")
     {
         ddlBranchI.DataSource = CourierDetails.GetCourier("Branch");
         ddlBranchI.DataBind();
         ddlBranchI.Items.Insert(0, new ListItem("--Select Branch Company--", "0"));
     }
     else if (rdLevel1.SelectedValue == "Others")
     {
         ddlBranch.DataSource = CourierDetails.GetCourier("Branch");
         ddlBranch.DataBind();
         ddlBranch.Items.Insert(0, new ListItem("--Select Branch Company--", "0"));
     }
 }
示例#12
0
    protected void btn_Save_Click(object sender, EventArgs e)
    {
        btnSave.Visible        = true;
        PnlSendCourier.Visible = true;
        divgrdCD.Visible       = true;
        grdCD.Visible          = true;
        ViewState["DocNo"]     = ViewState["DocNo"] + "," + lblDocumentNo.Text + ",";
        DataTable Ds = new DataTable();

        Ds = CourierDetails.Get_CourierDetailsCheck(Convert.ToString(ViewState["DocNo"]), "InvoiceNoGrid", Convert.ToInt32(strFY)).Tables[0];
        //Ds = CourierDetails.Get_CourierDetailsCheckSave(Convert.ToString(ViewState["DocNo"]), "InvoiceNoGrid", Convert.ToInt16(ddlCourier.SelectedValue.ToString()), Convert.ToInt16(ddlBranch.SelectedValue.ToString()), Convert.ToInt32(strFY)).Tables[0];

        grdCD.DataSource = Ds;
        grdCD.DataBind();
    }
示例#13
0
    protected void SaveGeneral_Click(object sender, EventArgs e)
    {
        DataSet Ds = new DataSet();

        Ds = CourierDetails.Get_CourierDetailsGeneral(Convert.ToString(ViewState["SCD"]), "GeneralGridSave", Convert.ToInt32(strFY));
        MessageBox("Record saved successfully");
        ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "window", "f_open_window_max('Print/PrintSendCourier.aspx?mFlag=GeneralCourierID&d=" + Ds.Tables[0].Rows[0]["GeneralCourierID"].ToString() + "')", true);
        //divLevel4.Visible = false;
        //divLevel2.Visible = true;
        //divLevel3.Visible = true;
        divgrdGeneral.Visible = false;
        txtAddress.Text       = "";
        Courier();
        Branch();
        ViewState["SCD"] = "";
    }
        public async Task <string> GetStatus(string consignmentId, CourierDetails courierDetails)
        {
            var count    = 1;
            var contract = await GetStatusResponse(consignmentId, courierDetails);

            // Keep polling for the consignment status
            while (string.IsNullOrEmpty(contract.Consignment_Url) && count++ <= courierSettings.MaxAttempt)
            {
                contract = await GetStatusResponse(consignmentId, courierDetails);
            }

            if (string.IsNullOrEmpty(contract.Consignment_Url))
            {
                throw new ServiceException($"Parcel Label Status {contract.Consignment_Status} for ConsignmentId {consignmentId} after {count-1} attempts.");
            }

            return(contract.Consignment_Url);
        }
示例#15
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        int SCD;

        try
        {
            CourierDetails _objCD = new CourierDetails();
            _objCD.Save(Convert.ToString(ViewState["DocNo"]), "DocNoGrid", Convert.ToInt32(strFY), Convert.ToString(Session["UserName"]), out SCD);
            MessageBox("Record saved successfully");
            //Response.Redirect("Print/PrintSendCourier.aspx?d=" + SCD + "");
            ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "window", "f_open_window_max('Print/PrintSendCourier.aspx?d=" + SCD + "')", true);

            grdCD.Visible        = false;
            btnSave.Visible      = false;
            txtInvoiceNoGet.Text = "";
            txtDocNoGet.Text     = "";
        }
        catch { }
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        int SCD;

        try
        { CourierDetails _objCD = new CourierDetails();
          if (ddlBranchEdit.SelectedValue != "0")
          {
              _objCD.Savecourier(Convert.ToString(lblSCDetailAutoId.Text), "Update", Convert.ToInt16(strFY), Convert.ToInt16(ddlCourierEdit.SelectedValue.ToString()), Convert.ToInt16(ddlBranchEdit.SelectedValue.ToString()), txtAddressEdit.Text.ToString(), Convert.ToString(Session["UserName"]), out SCD);
          }
          else
          {
              _objCD.Savecourier(Convert.ToString(lblSCDetailAutoId.Text), "Update", Convert.ToInt16(strFY), Convert.ToInt16(ddlCourierEdit.SelectedValue.ToString()), Convert.ToInt16(ddlBranchEdit.SelectedValue.ToString()), txtAddressGeneralEdit.Text.ToString(), Convert.ToString(Session["UserName"]), out SCD);
          }

          MessageBox("Record saved successfully");
          divEdit.Visible = false; }
        catch { }
    }
示例#17
0
    public void bindReport()
    {
        if (Request.QueryString["d"] != null)
        {
            ReportDocument rd = new ReportDocument();
            DataSet        ds = new DataSet();
            if (Request.QueryString["mFlag"] != "GeneralCourierID")
            {
                ds = CourierDetails.SendCourierPrint(float.Parse(Request.QueryString["d"].ToString()), "CourierId", Convert.ToInt32(strFY));
                if (ds.Tables[0].Rows[0]["EmpID"].ToString() != "0")
                {
                    rd.Load(Server.MapPath("../Report/ChetanaSendCourierPrint.rpt"));
                }
                else
                {
                    rd.Load(Server.MapPath("../Report/ChetanaSendCourierPrintNoBranch.rpt"));
                }
            }
            else
            {
                ds = CourierDetails.SendCourierPrintGeneral(float.Parse(Request.QueryString["d"].ToString()), "GeneralCourierID", Convert.ToInt32(strFY));
                if (ds.Tables[0].Rows[0]["EmpID"].ToString() != "0")
                {
                    rd.Load(Server.MapPath("../Report/ChetanaSendCourierGeneralPrint.rpt"));
                }
                else
                {
                    rd.Load(Server.MapPath("../Report/ChetanaSendCourierGeneralPNB.rpt"));
                }
            }
            // ds = CourierDetails.Get_CourierDetailsCheck(Convert.ToString(Request.QueryString["d"].ToString()), "DocNoGrid", Convert.ToInt32(strFY));

            // ds = G_GetPass.Local_Report(Convert.ToInt32(Request.QueryString["d"].ToString()), Request.QueryString["L"].ToString(), Convert.ToInt32(strFY));



            rd.Database.Tables[0].SetDataSource(ds.Tables[0]);


            LocalGodown.ReportSource = rd;
            LocalGodown.DataBind();
        }
    }
    public void SendEmail(string email, string mDocumentNo, int i)
    {
        try
        {
            MailMessage msg = new MailMessage();
            // msg.From = new MailAddress("*****@*****.**");

            String MFromID = ConfigurationManager.AppSettings["FromMail"].ToString();
            String MPwd    = ConfigurationManager.AppSettings["Password"].ToString();

            msg.From = new MailAddress(ConfigurationManager.AppSettings["FromMail"].ToString());
            msg.To.Add(new MailAddress("*****@*****.**"));
            msg.To.Add(new MailAddress(mToID));

            msg.Subject    = "Chetana Book Depot";
            msg.Body       = MailBodyDesign(i).ToString();
            msg.IsBodyHtml = true;
            SmtpClient smtp = new SmtpClient();
            smtp.Host = ConfigurationManager.AppSettings["SMTP"].ToString();
            smtp.Port = Convert.ToInt32(ConfigurationManager.AppSettings["Port"].ToString());
            smtp.UseDefaultCredentials = false;
            smtp.Credentials           = new System.Net.NetworkCredential(MFromID, MPwd);
            smtp.EnableSsl             = Convert.ToBoolean(ConfigurationManager.AppSettings["Enablessl"].ToString());
            try
            {
                smtp.Send(msg);
                DataSet DsMailLog = new DataSet();
                DsMailLog = CourierDetails.SendDispatchEmail(SCD, float.Parse(mDocumentNo), "DispatchEmail", "DispatchId", Convert.ToInt32(strFY),
                                                             MFromID, MPwd, Convert.ToString(Session["UserName"]));
                MessageBox("Mail Sent successfully");
            }
            catch (Exception ex)
            {
                MessageBox(ex.Message);
            }
        }
        catch (Exception ex)
        {
            MessageBox(ex.Message);
        }
    }
示例#19
0
    protected void RepDetailsConfirm_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        CourierDetails _objCD = new CourierDetails();

        try
        {
            DataSet  DS      = new DataSet();
            Repeater objrep  = (Repeater)this.FindControl("RepDetailsConfirm");
            GridView objgrid = (GridView)objrep.Items[e.Item.ItemIndex].FindControl("grdCD");
            foreach (GridViewRow row in objgrid.Rows)
            {
                _objCD.SCMasterAutoId = float.Parse(((Label)row.FindControl("lblSCMasterAutoId")).Text);
                _objCD.DocumentNo     = float.Parse(((Label)row.FindControl("lblDocumentNo")).Text);
                _objCD.InvoiceNo      = float.Parse(((Label)row.FindControl("lblInvoiceNo")).Text);
                _objCD.POD            = Convert.ToInt32(((TextBox)row.FindControl("txtPODId")).Text);
                _objCD.CreatedBy      = Convert.ToString(Session["UserName"]);

                if (txtCourierId.Text.ToString() != "")
                {
                    _objCD.UpdatePODNo(_objCD.SCMasterAutoId, _objCD.DocumentNo, _objCD.InvoiceNo, "CourierId", _objCD.POD, Convert.ToInt32(strFY));
                    DS = CourierDetails.UpdatePOD(float.Parse(txtCourierId.Text), "CourierId", Convert.ToInt32(strFY));
                }
                else if (txtInvoiceNoGet.Text.ToString() != "")
                {
                    _objCD.UpdatePODNo(_objCD.SCMasterAutoId, _objCD.DocumentNo, _objCD.InvoiceNo, "Invoice", _objCD.POD, Convert.ToInt32(strFY));
                    DS = CourierDetails.UpdatePOD(float.Parse(txtInvoiceNoGet.Text), "Invoice", Convert.ToInt32(strFY));
                }
                else if (txtDocNoGet.Text.ToString() != "")
                {
                    _objCD.UpdatePODNo(_objCD.SCMasterAutoId, _objCD.DocumentNo, _objCD.InvoiceNo, "DocNo", _objCD.POD, Convert.ToInt32(strFY));
                    DS = CourierDetails.UpdatePOD(float.Parse(txtDocNoGet.Text), "DocNo", Convert.ToInt32(strFY));
                }
            }
            RepDetailsConfirm.DataSource = DS.Tables[1];
            RepDetailsConfirm.DataBind();
        }
        catch (Exception ex)
        {
            MessageBox(ex.Message.ToString());
        }
    }
示例#20
0
    protected void btnget_Click(object sender, EventArgs e)
    {
        ViewState["DocNo"] = ViewState["DocNo"] + "," + txtDocNoGet.Text + ",";
        DataSet Ds = new DataSet();

        if (txtCourierId.Text.ToString() != "")
        {
            Ds = CourierDetails.UpdatePOD(float.Parse(txtCourierId.Text), "CourierId", Convert.ToInt32(strFY));
        }
        else if (txtInvoiceNoGet.Text.ToString() != "")
        {
            Ds = CourierDetails.UpdatePOD(float.Parse(txtInvoiceNoGet.Text), "Invoice", Convert.ToInt32(strFY));
        }
        else if (txtDocNoGet.Text.ToString() != "")
        {
            Ds = CourierDetails.UpdatePOD(float.Parse(txtDocNoGet.Text), "DocNo", Convert.ToInt32(strFY));
        }

        RepDetailsConfirm.DataSource = Ds.Tables[1];
        RepDetailsConfirm.DataBind();
    }
    protected void ddlBranchEdit_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (ddlBranchEdit.SelectedValue.ToString() != "0")
        {
            trBranchAddress.Visible = true;
            DataSet Ds = new DataSet();
            Ds = CourierDetails.GetCourierBranch(Convert.ToInt16(ddlBranchEdit.SelectedValue.ToString()), "BranchAddress");


            txtAddressEdit.Text = Ds.Tables[0].Rows[0]["Address"].ToString();
            Ds.Dispose();
            trAddressGeneralEdit.Visible = false;
            txtAddressGeneralEdit.Text   = "";
        }
        else
        {
            trBranchAddress.Visible      = false;
            txtAddressEdit.Text          = "";
            trAddressGeneralEdit.Visible = true;
        }
    }
    protected void btnget_Click(object sender, EventArgs e)
    {
        ViewState["DocNo"] = ViewState["DocNo"] + "," + txtDocNoGet.Text + ",";
        DataTable Ds = new DataTable();

        if (txtCourierId.Text.ToString() != "")
        {
            Ds = CourierDetails.ViewCourier(float.Parse(txtCourierId.Text), "CourierId", Convert.ToInt32(strFY)).Tables[0];
        }
        else if (txtInvoiceNoGet.Text.ToString() != "")
        {
            Ds = CourierDetails.ViewCourier(float.Parse(txtInvoiceNoGet.Text), "Invoice", Convert.ToInt32(strFY)).Tables[0];
        }
        else if (txtDocNoGet.Text.ToString() != "")
        {
            Ds = CourierDetails.ViewCourier(float.Parse(txtDocNoGet.Text), "DocNo", Convert.ToInt32(strFY)).Tables[0];
        }

        grdCD.DataSource = Ds;
        grdCD.DataBind();
    }
示例#23
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        int SCD;

        try
        {
            CourierDetails _objCD = new CourierDetails();
            _objCD.Save(Convert.ToString(ViewState["DocNo"]), "InvoiceNoGrid", Convert.ToInt16(strFY), Convert.ToInt16(ddlCourier.SelectedValue.ToString()), Convert.ToInt16(ddlBranch.SelectedValue.ToString()), txtAddress.Text.ToString(), txtDepartment.Text.ToString(), txtAddressGeneral.Text.ToString(), txtRemark.Text.ToString(), Convert.ToString(Session["UserName"]), txtweight.Text.ToString(), Convert.ToDateTime(DateTime.Now.ToString()), out SCD);
            MessageBox("Record saved successfully");
            ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "window", "f_open_window_max('Print/PrintSendCourier.aspx?d=" + SCD + "')", true);
            grdCD.Visible            = false;
            btnSave.Visible          = false;
            divData.Visible          = false;
            txtInvoiceNoGet.Text     = "";
            txtDocNoGet.Text         = "";
            txtAddress.Text          = "";
            ddlBranch.SelectedValue  = "0";
            ddlCourier.SelectedValue = "0";
            ViewState["DocNo"]       = "";
        }
        catch { }
    }
        public async Task <Consignment> Create(ParcelLabelRequest request, CourierDetails courierDetails)
        {
            var token = await authService.GetToken();

            httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {token}");
            httpClient.DefaultRequestHeaders.Add("user_name", courierDetails.Username);

            request.Pickup_Address.Country_Code   = courierSettings.CountryCode;
            request.Delivery_Address.Country_Code = courierSettings.CountryCode;
            request.Parcel_Details = new List <ParcelDetail> {
                new ParcelDetail(courierDetails.ServiceCode)
            };

            var uriBuilder  = new UriBuilder(courierSettings.ParcelLabelUrl);
            var jsonRequest = JsonConvert.SerializeObject(request, Formatting.None, serializerSettings);
            var jsonContent = new StringContent(jsonRequest, Encoding.UTF8, "application/json");
            var response    = await httpClient.PostAsync(uriBuilder.Uri, jsonContent);

            var result   = response.Content.ReadAsStringAsync().Result;
            var contract = JsonConvert.DeserializeObject <ParcelLabelResponseContract>(result, serializerSettings);

            if (!response.IsSuccessStatusCode || string.IsNullOrEmpty(contract.Consignment_Id))
            {
                logger.LogError($"Unsuccessful Parcel Label Create: {response.StatusCode}");
                throw new ServiceException(response.StatusCode, $"Parcel Label Create Error - {contract.Errors[0].Details}");
            }

            logger.LogDebug($"Parcel Label Create Job_Number:{request.Job_Number} Consignment_Id:{contract.Consignment_Id}");

            // Include any errors/wanrnings related to parcel label create
            if (contract.Errors != null && contract.Errors.Count != 0)
            {
                logger.LogWarning($"Consignment_Id:{contract.Consignment_Id} Details:{contract.Errors[0].Details}");
                return(new Consignment(contract.Consignment_Id, contract.Errors[0].Details));
            }

            return(new Consignment(contract.Consignment_Id));
        }
 public void BranchEdit()
 {
     ddlBranchEdit.DataSource = CourierDetails.GetCourier("Branch");
     ddlBranchEdit.DataBind();
     ddlBranchEdit.Items.Insert(0, new ListItem("--Select Branch Company--", "0"));
 }
 public void CourierEdit()
 {
     ddlCourierEdit.DataSource = CourierDetails.GetCourier("Courier");
     ddlCourierEdit.DataBind();
     ddlCourierEdit.Items.Insert(0, new ListItem("--Select Courier Company--", "0"));
 }
    protected void gdGeneral_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        try
        {
            CourierDetails _objCD = new CourierDetails();
            _objCD.UpDateBy       = Convert.ToString(Session["UserName"]);
            _objCD.SCMasterAutoId = float.Parse(((Label)gdGeneral.Rows[e.RowIndex].FindControl("lblSCDetailAutoId")).Text);
            _objCD.IsActive       = Convert.ToBoolean(false);
            _objCD.DeleteSendcourier(_objCD.SCMasterAutoId, _objCD.IsActive, _objCD.UpDateBy, Convert.ToInt32(strFY));
            MessageBox("Record Deleted successfully");
            ViewState["DocNo"] = ViewState["DocNo"] + "," + txtDocNoGet.Text + ",";
            DataTable Ds = new DataTable();
            if (txtCourierId.Text.ToString() != "")
            {
                Ds = CourierDetails.ViewCourier(float.Parse(txtCourierId.Text), "CourierId", Convert.ToInt32(strFY)).Tables[0];
            }
            else if (txtInvoiceNoGet.Text.ToString() != "")
            {
                Ds = CourierDetails.ViewCourier(float.Parse(txtInvoiceNoGet.Text), "Invoice", Convert.ToInt32(strFY)).Tables[0];
            }
            else if (txtDocNoGet.Text.ToString() != "")
            {
                Ds = CourierDetails.ViewCourier(float.Parse(txtDocNoGet.Text), "DocNo", Convert.ToInt32(strFY)).Tables[0];
            }
            else if (txtGeneralCourierID.Text.ToString() != "")
            {
                Ds = CourierDetails.ViewCourier(float.Parse(txtGeneralCourierID.Text), "GeneralCourierID", Convert.ToInt32(strFY)).Tables[0];
            }

            else if (ddlBranch.SelectedValue.ToString() != "0" && (rdLevel1.SelectedValue == "Others"))
            {
                if ((txtFromGeneral.Text.ToString()) != "" && (txtToGeneral.Text.ToString() != "" && (rdLevel1.SelectedValue == "Others")))
                {
                    Ds = CourierDetails.ViewCourierDate(0, (txtFromGeneral.Text.Split('/')[1] + "/" + txtFromGeneral.Text.Split('/')[0] + "/" + txtFromGeneral.Text.Split('/')[2]) + " 00:00:00", (txtToGeneral.Text.Split('/')[1] + "/" + txtToGeneral.Text.Split('/')[0] + "/" + txtToGeneral.Text.Split('/')[2]) + " 23:59:59", ddlBranch.SelectedValue.ToString(), ddlCourier.SelectedValue.ToString(), "GeneralBranch", Convert.ToInt32(strFY)).Tables[0];
                }
                else
                {
                    Ds = CourierDetails.ViewCourierDate(0, "", "", ddlBranch.SelectedValue.ToString(), ddlCourier.SelectedValue.ToString(), "GeneralBranch", Convert.ToInt32(strFY)).Tables[0];
                }
            }
            else if ((ddlCourier.SelectedValue.ToString() != "0") && (rdLevel1.SelectedValue == "Others"))
            {
                if ((txtFromGeneral.Text.ToString()) != "" && (txtToGeneral.Text.ToString() != "" && (rdLevel1.SelectedValue == "Others")))
                {
                    Ds = CourierDetails.ViewCourierDate(0, (txtFromGeneral.Text.Split('/')[1] + "/" + txtFromGeneral.Text.Split('/')[0] + "/" + txtFromGeneral.Text.Split('/')[2]) + " 00:00:00", (txtToGeneral.Text.Split('/')[1] + "/" + txtToGeneral.Text.Split('/')[0] + "/" + txtToGeneral.Text.Split('/')[2]) + " 23:59:59", ddlBranch.SelectedValue.ToString(), ddlCourier.SelectedValue.ToString(), "GeneralCourier", Convert.ToInt32(strFY)).Tables[0];
                }
                else
                {
                    Ds = CourierDetails.ViewCourierDate(0, "", "", ddlBranch.SelectedValue.ToString(), ddlCourier.SelectedValue.ToString(), "GeneralCourier", Convert.ToInt32(strFY)).Tables[0];
                }
            }
            else if (ddlBranchI.SelectedValue.ToString() != "0" && (rdLevel1.SelectedValue == "InvoiceNo"))
            {
                if ((txtFrom.Text.ToString()) != "" && (txtTo.Text.ToString() != "") && (rdLevel1.SelectedValue == "InvoiceNo"))
                {
                    Ds = CourierDetails.ViewCourierDate(0, (txtFrom.Text.Split('/')[1] + "/" + txtFrom.Text.Split('/')[0] + "/" + txtFrom.Text.Split('/')[2]) + " 00:00:00", (txtTo.Text.Split('/')[1] + "/" + txtTo.Text.Split('/')[0] + "/" + txtTo.Text.Split('/')[2]) + " 23:59:59", ddlBranchI.SelectedValue.ToString(), ddlCourierI.SelectedValue.ToString(), "InvoiceBranch", Convert.ToInt32(strFY)).Tables[0];
                }
                else
                {
                    Ds = CourierDetails.ViewCourierDate(0, "", "", ddlBranchI.SelectedValue.ToString(), ddlCourierI.SelectedValue.ToString(), "InvoiceBranch", Convert.ToInt32(strFY)).Tables[0];
                }
            }
            else if ((ddlCourierI.SelectedValue.ToString() != "0") && (rdLevel1.SelectedValue == "InvoiceNo"))
            {
                if ((txtFrom.Text.ToString()) != "" && (txtTo.Text.ToString() != "") && (rdLevel1.SelectedValue == "InvoiceNo"))
                {
                    Ds = CourierDetails.ViewCourierDate(0, (txtFrom.Text.Split('/')[1] + "/" + txtFrom.Text.Split('/')[0] + "/" + txtFrom.Text.Split('/')[2]) + " 00:00:00", (txtTo.Text.Split('/')[1] + "/" + txtTo.Text.Split('/')[0] + "/" + txtTo.Text.Split('/')[2]) + " 23:59:59", ddlBranchI.SelectedValue.ToString(), ddlCourierI.SelectedValue.ToString(), "InvoiceCourier", Convert.ToInt32(strFY)).Tables[0];
                }
                else
                {
                    Ds = CourierDetails.ViewCourierDate(0, "", "", ddlBranchI.SelectedValue.ToString(), ddlCourierI.SelectedValue.ToString(), "InvoiceCourier", Convert.ToInt32(strFY)).Tables[0];
                }
            }
            else if ((txtFrom.Text.ToString()) != "" && (txtTo.Text.ToString() != "") && (rdLevel1.SelectedValue == "InvoiceNo"))
            {
                Ds = CourierDetails.ViewCourierDate(0, (txtFrom.Text.Split('/')[1] + "/" + txtFrom.Text.Split('/')[0] + "/" + txtFrom.Text.Split('/')[2]) + " 00:00:00", (txtTo.Text.Split('/')[1] + "/" + txtTo.Text.Split('/')[0] + "/" + txtTo.Text.Split('/')[2]) + " 23:59:59", ddlBranch.SelectedValue.ToString(), ddlCourier.SelectedValue.ToString(), "Date", Convert.ToInt32(strFY)).Tables[0];
            }
            else if ((txtFromGeneral.Text.ToString()) != "" && (txtToGeneral.Text.ToString() != "" && (rdLevel1.SelectedValue == "Others")))
            {
                Ds = CourierDetails.ViewCourierDate(0, (txtFromGeneral.Text.Split('/')[1] + "/" + txtFromGeneral.Text.Split('/')[0] + "/" + txtFromGeneral.Text.Split('/')[2]) + " 00:00:00", (txtToGeneral.Text.Split('/')[1] + "/" + txtToGeneral.Text.Split('/')[0] + "/" + txtToGeneral.Text.Split('/')[2]) + " 23:59:59", ddlBranch.SelectedValue.ToString(), ddlCourier.SelectedValue.ToString(), "GeneralDate", Convert.ToInt32(strFY)).Tables[0];
            }
            if (rdLevel1.SelectedValue != "Others")
            {
                grdCD.DataSource = Ds;
                grdCD.DataBind();
            }
            else
            {
                gdGeneral.DataSource = Ds;
                gdGeneral.DataBind();
            }
            txtCourierId.Text         = "";
            txtInvoiceNoGet.Text      = "";
            txtDocNoGet.Text          = "";
            ddlBranchI.SelectedValue  = "0";
            ddlCourierI.SelectedValue = "0";
            //txtFrom.Text = "";
            //txtTo.Text = "";
            txtGeneralCourierID.Text = "";
            ddlBranch.SelectedValue  = "0";
            ddlCourier.SelectedValue = "0";
        }
        catch
        {
        }
    }
    protected void btnget_Click(object sender, EventArgs e)
    {
        ViewState["DocNo"] = ViewState["DocNo"] + "," + txtDocNoGet.Text + ",";
        DataTable Ds = new DataTable();

        if (txtCourierId.Text.ToString() != "")
        {
            Ds = CourierDetails.ViewCourier(float.Parse(txtCourierId.Text), "CourierId", Convert.ToInt32(strFY)).Tables[0];
        }
        else if (txtInvoiceNoGet.Text.ToString() != "")
        {
            Ds = CourierDetails.ViewCourier(float.Parse(txtInvoiceNoGet.Text), "Invoice", Convert.ToInt32(strFY)).Tables[0];
        }
        else if (txtDocNoGet.Text.ToString() != "")
        {
            Ds = CourierDetails.ViewCourier(float.Parse(txtDocNoGet.Text), "DocNo", Convert.ToInt32(strFY)).Tables[0];
        }
        else if (txtGeneralCourierID.Text.ToString() != "")
        {
            Ds = CourierDetails.ViewCourier(float.Parse(txtGeneralCourierID.Text), "GeneralCourierID", Convert.ToInt32(strFY)).Tables[0];
        }

        else if (ddlBranch.SelectedValue.ToString() != "0" && (rdLevel1.SelectedValue == "Others"))
        {
            if ((txtFromGeneral.Text.ToString()) != "" && (txtToGeneral.Text.ToString() != "" && (rdLevel1.SelectedValue == "Others")))
            {
                Ds = CourierDetails.ViewCourierDate(0, (txtFromGeneral.Text.Split('/')[1] + "/" + txtFromGeneral.Text.Split('/')[0] + "/" + txtFromGeneral.Text.Split('/')[2]) + " 00:00:00", (txtToGeneral.Text.Split('/')[1] + "/" + txtToGeneral.Text.Split('/')[0] + "/" + txtToGeneral.Text.Split('/')[2]) + " 23:59:59", ddlBranch.SelectedValue.ToString(), ddlCourier.SelectedValue.ToString(), "GeneralBranch", Convert.ToInt32(strFY)).Tables[0];
            }
            else
            {
                Ds = CourierDetails.ViewCourierDate(0, "", "", ddlBranch.SelectedValue.ToString(), ddlCourier.SelectedValue.ToString(), "GeneralBranch", Convert.ToInt32(strFY)).Tables[0];
            }
        }
        else if ((ddlCourier.SelectedValue.ToString() != "0") && (rdLevel1.SelectedValue == "Others"))
        {
            if ((txtFromGeneral.Text.ToString()) != "" && (txtToGeneral.Text.ToString() != "" && (rdLevel1.SelectedValue == "Others")))
            {
                Ds = CourierDetails.ViewCourierDate(0, (txtFromGeneral.Text.Split('/')[1] + "/" + txtFromGeneral.Text.Split('/')[0] + "/" + txtFromGeneral.Text.Split('/')[2]) + " 00:00:00", (txtToGeneral.Text.Split('/')[1] + "/" + txtToGeneral.Text.Split('/')[0] + "/" + txtToGeneral.Text.Split('/')[2]) + " 23:59:59", ddlBranch.SelectedValue.ToString(), ddlCourier.SelectedValue.ToString(), "GeneralCourier", Convert.ToInt32(strFY)).Tables[0];
            }
            else
            {
                Ds = CourierDetails.ViewCourierDate(0, "", "", ddlBranch.SelectedValue.ToString(), ddlCourier.SelectedValue.ToString(), "GeneralCourier", Convert.ToInt32(strFY)).Tables[0];
            }
        }
        else if (ddlBranchI.SelectedValue.ToString() != "0" && (rdLevel1.SelectedValue == "InvoiceNo"))
        {
            if ((txtFrom.Text.ToString()) != "" && (txtTo.Text.ToString() != "") && (rdLevel1.SelectedValue == "InvoiceNo"))
            {
                Ds = CourierDetails.ViewCourierDate(0, (txtFrom.Text.Split('/')[1] + "/" + txtFrom.Text.Split('/')[0] + "/" + txtFrom.Text.Split('/')[2]) + " 00:00:00", (txtTo.Text.Split('/')[1] + "/" + txtTo.Text.Split('/')[0] + "/" + txtTo.Text.Split('/')[2]) + " 23:59:59", ddlBranchI.SelectedValue.ToString(), ddlCourierI.SelectedValue.ToString(), "InvoiceBranch", Convert.ToInt32(strFY)).Tables[0];
            }
            else
            {
                Ds = CourierDetails.ViewCourierDate(0, "", "", ddlBranchI.SelectedValue.ToString(), ddlCourierI.SelectedValue.ToString(), "InvoiceBranch", Convert.ToInt32(strFY)).Tables[0];
            }
        }
        else if ((ddlCourierI.SelectedValue.ToString() != "0") && (rdLevel1.SelectedValue == "InvoiceNo"))
        {
            if ((txtFrom.Text.ToString()) != "" && (txtTo.Text.ToString() != "") && (rdLevel1.SelectedValue == "InvoiceNo"))
            {
                Ds = CourierDetails.ViewCourierDate(0, (txtFrom.Text.Split('/')[1] + "/" + txtFrom.Text.Split('/')[0] + "/" + txtFrom.Text.Split('/')[2]) + " 00:00:00", (txtTo.Text.Split('/')[1] + "/" + txtTo.Text.Split('/')[0] + "/" + txtTo.Text.Split('/')[2]) + " 23:59:59", ddlBranchI.SelectedValue.ToString(), ddlCourierI.SelectedValue.ToString(), "InvoiceCourier", Convert.ToInt32(strFY)).Tables[0];
            }
            else
            {
                Ds = CourierDetails.ViewCourierDate(0, "", "", ddlBranchI.SelectedValue.ToString(), ddlCourierI.SelectedValue.ToString(), "InvoiceCourier", Convert.ToInt32(strFY)).Tables[0];
            }
        }
        else if ((txtFrom.Text.ToString()) != "" && (txtTo.Text.ToString() != "") && (rdLevel1.SelectedValue == "InvoiceNo"))
        {
            Ds = CourierDetails.ViewCourierDate(0, (txtFrom.Text.Split('/')[1] + "/" + txtFrom.Text.Split('/')[0] + "/" + txtFrom.Text.Split('/')[2]) + " 00:00:00", (txtTo.Text.Split('/')[1] + "/" + txtTo.Text.Split('/')[0] + "/" + txtTo.Text.Split('/')[2]) + " 23:59:59", ddlBranch.SelectedValue.ToString(), ddlCourier.SelectedValue.ToString(), "Date", Convert.ToInt32(strFY)).Tables[0];
        }
        else if ((txtFromGeneral.Text.ToString()) != "" && (txtToGeneral.Text.ToString() != "" && (rdLevel1.SelectedValue == "Others")))
        {
            Ds = CourierDetails.ViewCourierDate(0, (txtFromGeneral.Text.Split('/')[1] + "/" + txtFromGeneral.Text.Split('/')[0] + "/" + txtFromGeneral.Text.Split('/')[2]) + " 00:00:00", (txtToGeneral.Text.Split('/')[1] + "/" + txtToGeneral.Text.Split('/')[0] + "/" + txtToGeneral.Text.Split('/')[2]) + " 23:59:59", ddlBranch.SelectedValue.ToString(), ddlCourier.SelectedValue.ToString(), "GeneralDate", Convert.ToInt32(strFY)).Tables[0];
        }
        DataView dv = new DataView(Ds);

        ViewState["Data"] = Ds;
        ReportDocument rd = new ReportDocument();

        if (rdLevel1.SelectedValue != "Others")
        {
            // rd.Load(Server.MapPath("Report/ChetanaViewCourierCR.rpt"));
            rd.Load(Server.MapPath("Report/ChetanaViewCourierPrint1.rpt"));
        }
        else
        {
            //rd.Load(Server.MapPath("Report/ChetanaViewCourierGeneral.rpt"));
            // rd.Load(Server.MapPath("Report/ChetanaViewCourier2.rpt"));
        }

        rd.Database.Tables[0].SetDataSource(dv);
        ChetanaViewCourier.ReportSource = rd;
        txtCourierId.Text         = "";
        txtInvoiceNoGet.Text      = "";
        txtDocNoGet.Text          = "";
        ddlBranchI.SelectedValue  = "0";
        ddlCourierI.SelectedValue = "0";
        Ds.Dispose();
        //txtFrom.Text = "";
        //txtTo.Text = "";
        //txtGeneralCourierID.Text = "";
        //ddlBranch.SelectedValue = "0";
        //ddlCourier.SelectedValue = "0";
        //txtFromGeneral.Text = "";
        //txtToGeneral.Text = "";
    }
    protected void btnget_Click(object sender, EventArgs e)
    {
        ViewState["DocNo"] = ViewState["DocNo"] + "," + txtDocNoGet.Text + ",";
        DataTable Ds = new DataTable();

        if (txtCourierId.Text.ToString() != "")
        {
            Ds = CourierDetails.ViewCourier(float.Parse(txtCourierId.Text), "CourierId", Convert.ToInt32(strFY)).Tables[0];
        }
        else if (txtInvoiceNoGet.Text.ToString() != "")
        {
            Ds = CourierDetails.ViewCourier(float.Parse(txtInvoiceNoGet.Text), "Invoice", Convert.ToInt32(strFY)).Tables[0];
        }
        else if (txtDocNoGet.Text.ToString() != "")
        {
            Ds = CourierDetails.ViewCourier(float.Parse(txtDocNoGet.Text), "DocNo", Convert.ToInt32(strFY)).Tables[0];
        }
        else if (txtGeneralCourierID.Text.ToString() != "")
        {
            Ds = CourierDetails.ViewCourier(float.Parse(txtGeneralCourierID.Text), "GeneralCourierID", Convert.ToInt32(strFY)).Tables[0];
        }

        else if (ddlBranch.SelectedValue.ToString() != "0" && (rdLevel1.SelectedValue == "Others"))
        {
            if ((txtFromGeneral.Text.ToString()) != "" && (txtToGeneral.Text.ToString() != "" && (rdLevel1.SelectedValue == "Others")))
            {
                Ds = CourierDetails.ViewCourierDate(0, (txtFromGeneral.Text.Split('/')[1] + "/" + txtFromGeneral.Text.Split('/')[0] + "/" + txtFromGeneral.Text.Split('/')[2]) + " 00:00:00", (txtToGeneral.Text.Split('/')[1] + "/" + txtToGeneral.Text.Split('/')[0] + "/" + txtToGeneral.Text.Split('/')[2]) + " 23:59:59", ddlBranch.SelectedValue.ToString(), ddlCourier.SelectedValue.ToString(), "GeneralBranch", Convert.ToInt32(strFY)).Tables[0];
            }
            else
            {
                Ds = CourierDetails.ViewCourierDate(0, "", "", ddlBranch.SelectedValue.ToString(), ddlCourier.SelectedValue.ToString(), "GeneralBranch", Convert.ToInt32(strFY)).Tables[0];
            }
        }
        else if ((ddlCourier.SelectedValue.ToString() != "0") && (rdLevel1.SelectedValue == "Others"))
        {
            if ((txtFromGeneral.Text.ToString()) != "" && (txtToGeneral.Text.ToString() != "" && (rdLevel1.SelectedValue == "Others")))
            {
                Ds = CourierDetails.ViewCourierDate(0, (txtFromGeneral.Text.Split('/')[1] + "/" + txtFromGeneral.Text.Split('/')[0] + "/" + txtFromGeneral.Text.Split('/')[2]) + " 00:00:00", (txtToGeneral.Text.Split('/')[1] + "/" + txtToGeneral.Text.Split('/')[0] + "/" + txtToGeneral.Text.Split('/')[2]) + " 23:59:59", ddlBranch.SelectedValue.ToString(), ddlCourier.SelectedValue.ToString(), "GeneralCourier", Convert.ToInt32(strFY)).Tables[0];
            }
            else
            {
                Ds = CourierDetails.ViewCourierDate(0, "", "", ddlBranch.SelectedValue.ToString(), ddlCourier.SelectedValue.ToString(), "GeneralCourier", Convert.ToInt32(strFY)).Tables[0];
            }
        }
        else if (ddlBranchI.SelectedValue.ToString() != "0" && (rdLevel1.SelectedValue == "InvoiceNo"))
        {
            if ((txtFrom.Text.ToString()) != "" && (txtTo.Text.ToString() != "") && (rdLevel1.SelectedValue == "InvoiceNo"))
            {
                Ds = CourierDetails.ViewCourierDate(0, (txtFrom.Text.Split('/')[1] + "/" + txtFrom.Text.Split('/')[0] + "/" + txtFrom.Text.Split('/')[2]) + " 00:00:00", (txtTo.Text.Split('/')[1] + "/" + txtTo.Text.Split('/')[0] + "/" + txtTo.Text.Split('/')[2]) + " 23:59:59", ddlBranchI.SelectedValue.ToString(), ddlCourierI.SelectedValue.ToString(), "InvoiceBranch", Convert.ToInt32(strFY)).Tables[0];
            }
            else
            {
                Ds = CourierDetails.ViewCourierDate(0, "", "", ddlBranchI.SelectedValue.ToString(), ddlCourierI.SelectedValue.ToString(), "InvoiceBranch", Convert.ToInt32(strFY)).Tables[0];
            }
        }
        else if ((ddlCourierI.SelectedValue.ToString() != "0") && (rdLevel1.SelectedValue == "InvoiceNo"))
        {
            if ((txtFrom.Text.ToString()) != "" && (txtTo.Text.ToString() != "") && (rdLevel1.SelectedValue == "InvoiceNo"))
            {
                Ds = CourierDetails.ViewCourierDate(0, (txtFrom.Text.Split('/')[1] + "/" + txtFrom.Text.Split('/')[0] + "/" + txtFrom.Text.Split('/')[2]) + " 00:00:00", (txtTo.Text.Split('/')[1] + "/" + txtTo.Text.Split('/')[0] + "/" + txtTo.Text.Split('/')[2]) + " 23:59:59", ddlBranchI.SelectedValue.ToString(), ddlCourierI.SelectedValue.ToString(), "InvoiceCourier", Convert.ToInt32(strFY)).Tables[0];
            }
            else
            {
                Ds = CourierDetails.ViewCourierDate(0, "", "", ddlBranchI.SelectedValue.ToString(), ddlCourierI.SelectedValue.ToString(), "InvoiceCourier", Convert.ToInt32(strFY)).Tables[0];
            }
        }
        else if ((txtFrom.Text.ToString()) != "" && (txtTo.Text.ToString() != "") && (rdLevel1.SelectedValue == "InvoiceNo"))
        {
            Ds = CourierDetails.ViewCourierDate(0, (txtFrom.Text.Split('/')[1] + "/" + txtFrom.Text.Split('/')[0] + "/" + txtFrom.Text.Split('/')[2]) + " 00:00:00", (txtTo.Text.Split('/')[1] + "/" + txtTo.Text.Split('/')[0] + "/" + txtTo.Text.Split('/')[2]) + " 23:59:59", ddlBranch.SelectedValue.ToString(), ddlCourier.SelectedValue.ToString(), "Date", Convert.ToInt32(strFY)).Tables[0];
        }
        else if ((txtFromGeneral.Text.ToString()) != "" && (txtToGeneral.Text.ToString() != "" && (rdLevel1.SelectedValue == "Others")))
        {
            Ds = CourierDetails.ViewCourierDate(0, (txtFromGeneral.Text.Split('/')[1] + "/" + txtFromGeneral.Text.Split('/')[0] + "/" + txtFromGeneral.Text.Split('/')[2]) + " 00:00:00", (txtToGeneral.Text.Split('/')[1] + "/" + txtToGeneral.Text.Split('/')[0] + "/" + txtToGeneral.Text.Split('/')[2]) + " 23:59:59", ddlBranch.SelectedValue.ToString(), ddlCourier.SelectedValue.ToString(), "GeneralDate", Convert.ToInt32(strFY)).Tables[0];
        }
        if (rdLevel1.SelectedValue != "Others")
        {
            grdCD.DataSource = Ds;
            grdCD.DataBind();
        }
        else
        {
            gdGeneral.DataSource = Ds;
            gdGeneral.DataBind();
        }
        //txtCourierId.Text = "";
        //txtInvoiceNoGet.Text = "";
        //txtDocNoGet.Text = "";
        //ddlBranchI.SelectedValue = "0";
        //ddlCourierI.SelectedValue = "0";
        //txtFrom.Text = "";
        //txtTo.Text = "";
        //txtGeneralCourierID.Text = "";
        //ddlBranch.SelectedValue = "0";
        //ddlCourier.SelectedValue = "0";
        //txtFromGeneral.Text = "";
        //txtToGeneral.Text = "";
    }
示例#30
0
    protected void btnget_Click(object sender, EventArgs e)
    {
        Int32     count = 0;
        DataTable Ds    = new DataTable();
        DataRow   R;

        if (txtInvoiceNoGet.Text.ToString() != "")
        {
            Ds = CourierDetails.Get_CourierDetails(float.Parse(txtInvoiceNoGet.Text), "Invoice", Convert.ToInt32(strFY)).Tables[0];
            if (Ds.Rows.Count == 0)
            {
                lblMessage.Text = "Invoice Is Not Created.";
            }
        }
        else if (txtDocNoGet.Text.ToString() != "")
        {
            Ds = CourierDetails.Get_CourierDetails(float.Parse(txtDocNoGet.Text), "DocNoCheck", Convert.ToInt32(strFY)).Tables[0];
            if (Ds.Rows.Count != 0)
            {
                message_error.Visible = true;
                lblMessage.Text       = "Invoice Is Already Created.";
                count = Ds.Rows.Count;
            }

            else
            {
                Ds = CourierDetails.Get_CourierDetails(float.Parse(txtDocNoGet.Text), "DocNo", Convert.ToInt32(strFY)).Tables[0];
            }
        }
        if (count == 0)
        {
            if (Ds.Rows.Count != 0)
            {
                PnlSendCourier.Visible = true;

                for (int k = 0; k <= Ds.Rows.Count - 1; k++)
                {
                    R = Ds.Rows[k];

                    for (int i = 0; i <= Ds.Columns.Count - 1; i++)
                    {
                        if (txtInvoiceNoGet.Text.ToString() != "")
                        {
                            lblInvoiceNoH.Visible = true;
                            lblInvoiceNo.Visible  = true;
                            lblInvoiceNo.Text     = R[3].ToString();
                        }
                        else
                        {
                            lblInvoiceNoH.Visible = false;
                            lblInvoiceNo.Visible  = false;
                        }
                        lblDocumentNo.Text     = R[2].ToString();
                        lblAddress.Text        = R[13].ToString();
                        lblPhone1.Text         = R[14].ToString();
                        lblCustomerName.Text   = R[6].ToString();
                        lblPersonIncharge.Text = R[15].ToString();
                    }
                }
            }
        }
    }