Exemplo n.º 1
0
    //protected void btnClear_Click(object sender, EventArgs e)
    //{
    //    txtCardNo.Text = "";
    //    //txtSignature.Text = "";
    //    txtCustomerName.Text = "";
    //    //ddlReference.SelectedIndex = 0;
    //    txtAddress.Text = "";
    //    txtContactNo.Text = "";
    //    txtPhone.Text = "";
    //    txtDiscountPersent.Text = "";
    //    txtRemark.Text = "";
    //    txtBranchNo.Text = "";
    //    txtCompanyName.Text = "";
    //    txtOfficeAddress.Text = "";
    //    txtdesignation.Text = "";
    //    txtOccupation.Text = "";
    //    //txtAddedBy.Text = "";
    //    //txtUpdatedBy.Text = "";
    //    //txtUpdatedDate.Text = "";
    //    //ddlRowSatatus.SelectedIndex = 0;
    //}
    private void showPos_CustomerData()
    {
        Pos_Customer pos_Customer = new Pos_Customer();

        pos_Customer = Pos_CustomerManager.GetPos_CustomerByID(Int32.Parse(Request.QueryString["pos_CustomerID"]));

        ddlBranch.SelectedValue   = pos_Customer.ExtraFiled1;
        txtCustomerName.Text      = pos_Customer.CustomerName;
        txtAddress.Text           = pos_Customer.Address;
        txtCompanyName.Text       = pos_Customer.ExtraFiled2;
        txtOfficeAddress.Text     = pos_Customer.ExtraFiled3;
        txtPhone.Text             = pos_Customer.Phone;
        txtdesignation.Text       = pos_Customer.ExtraFiled4;
        txtOccupation.Text        = pos_Customer.ExtraFiled5;
        txtDateofBirth.Text       = pos_Customer.DateofBirth.ToString("dd MMM yyyy");
        txtContactNo.Text         = pos_Customer.Mobile;
        txtApplicationDate.Text   = pos_Customer.ApplicationDate.ToString("dd MMM yyyy");
        txtCardNo.Text            = pos_Customer.CardNo;
        txtCardIssueDate.Text     = pos_Customer.CardIssueDate.ToString("dd MMM yyyy");
        txtExpireDate.Text        = pos_Customer.ExpireDate.ToString("dd MMM yyyy");
        ddlCardType.SelectedValue = pos_Customer.CardType;
        txtDiscountPersent.Text   = pos_Customer.DiscountPersent.ToString("0.00");
        //txtSignature.Text = pos_Customer.Signature;
        txtApprovedBy.Text         = pos_Customer.ApprovedBy;
        txtRemark.Text             = pos_Customer.Note;
        ddlReference.SelectedValue = pos_Customer.ReferenceID.ToString();
        //ddlReference.SelectedValue = pos_Customer.ReferenceID.ToString();
        //ddlRowSatatus.SelectedValue = pos_Customer.RowSatatusID.ToString();
    }
Exemplo n.º 2
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        Pos_Customer pos_Customer = new Pos_Customer();

        pos_Customer = Pos_CustomerManager.GetPos_CustomerByID(Int32.Parse(Request.QueryString["pos_CustomerID"]));
        Pos_Customer tempPos_Customer = new Pos_Customer();

        tempPos_Customer.Pos_CustomerID  = pos_Customer.Pos_CustomerID;
        tempPos_Customer.ExtraFiled1     = ddlBranch.SelectedValue;
        tempPos_Customer.CustomerName    = txtCustomerName.Text;
        tempPos_Customer.Address         = txtAddress.Text;
        tempPos_Customer.ExtraFiled2     = txtCompanyName.Text;
        tempPos_Customer.ExtraFiled3     = txtOfficeAddress.Text;
        tempPos_Customer.Phone           = txtPhone.Text;
        tempPos_Customer.ExtraFiled4     = txtdesignation.Text;
        tempPos_Customer.ExtraFiled5     = txtOccupation.Text;
        tempPos_Customer.DateofBirth     = Convert.ToDateTime(txtDateofBirth.Text);
        tempPos_Customer.Mobile          = txtContactNo.Text;
        tempPos_Customer.ApplicationDate = Convert.ToDateTime(txtApplicationDate.Text);
        tempPos_Customer.CardNo          = txtCardNo.Text;
        tempPos_Customer.CardIssueDate   = Convert.ToDateTime(txtCardIssueDate.Text);
        tempPos_Customer.ExpireDate      = Convert.ToDateTime(txtExpireDate.Text);
        tempPos_Customer.CardType        = ddlCardType.SelectedValue;
        //tempPos_Customer.Signature = txtSignature.Text;
        if (uplFile.PostedFile != null && uplFile.PostedFile.ContentLength > 0)
        {
            try
            {
                string dirUrl  = "~/Upload";
                string dirPath = Server.MapPath(dirUrl);

                if (!Directory.Exists(dirPath))
                {
                    Directory.CreateDirectory(dirPath);
                }
                string fileName = Path.GetFileName(uplFile.PostedFile.FileName);
                string fileUrl  = dirUrl + "/" + Path.GetFileName(uplFile.PostedFile.FileName);
                string filePath = Server.MapPath(fileUrl);
                uplFile.PostedFile.SaveAs(filePath);

                tempPos_Customer.Signature = dirUrl + "/" + fileName;
            }
            catch (Exception ex)
            {
                ex.Message.ToString();
            }
        }
        else
        {
            tempPos_Customer.Signature = pos_Customer.Signature;
        }
        tempPos_Customer.ApprovedBy  = txtApprovedBy.Text;
        tempPos_Customer.Note        = txtRemark.Text;
        tempPos_Customer.ReferenceID = Convert.ToInt32(ddlReference.SelectedValue);

        tempPos_Customer.DiscountPersent = Decimal.Parse(txtDiscountPersent.Text);
        tempPos_Customer.AddedBy         = 1;
        tempPos_Customer.AddedDate       = DateTime.Now;
        tempPos_Customer.UpdatedBy       = 1;
        tempPos_Customer.UpdatedDate     = DateTime.Now;
        tempPos_Customer.RowSatatusID    = 1;
        bool result = Pos_CustomerManager.UpdatePos_Customer(tempPos_Customer);

        Response.Redirect("AdminPos_CustomerDisplay.aspx");
    }