コード例 #1
0
    protected void UpdateButton_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            try
            {
                string connection = Request.Cookies["Company"].Value;
                string UserID     = Request.Cookies["LoggedUserName"].Value;

                InternalTransferRequest  request = new InternalTransferRequest();
                IInternalTransferService bl      = new BusinessLogic(connection);

                request.RequestID = int.Parse(hdRequestID.Value);
                request.UserID    = UserID;

                if (cmbProd.SelectedValue != "0")
                {
                    request.ItemCode = cmbProd.SelectedValue;
                }
                if (cmbRequestedBranch.SelectedValue != "0")
                {
                    request.RequestedBranch = cmbRequestedBranch.SelectedValue;
                }
                if (cmbBranchHasStock.SelectedValue != "0")
                {
                    request.BranchHasStock = cmbBranchHasStock.SelectedValue;
                }

                if (cmbStatus.SelectedValue != "0")
                {
                    request.Status = cmbStatus.SelectedValue;
                }

                if (!string.IsNullOrEmpty(txtRequestedDate.Text))
                {
                    request.RequestedDate = Convert.ToDateTime(txtRequestedDate.Text);
                }

                if (!string.IsNullOrEmpty(txtQtyAdd.Text))
                {
                    request.Quantity = Convert.ToDecimal(txtQtyAdd.Text);
                }

                bl.UpdateInternalRequest(connection, request);

                ModalPopupExtender1.Hide();

                BindGridData();

                contentPopUp.Visible = false;

                ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Internal Transfer Request Saved Successfully.');", true);
            }
            catch (Exception ex)
            {
                TroyLiteExceptionManager.HandleException(ex);
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Error occured while saving details. Please contact Administrator');", true);
            }
        }
    }
コード例 #2
0
    public void RejectInternalTrasfer(string connection, InternalTransferRequest request)
    {
        string sDataSource = CreateConnectionString(connection);

        DBManager manager = new DBManager(DataProvider.SqlServer);

        manager.ConnectionString = sDataSource.ToLower();
        DataSet ds        = new DataSet();
        string  dbQry     = string.Empty;
        string  sAuditStr = string.Empty;

        string Status = "Rejected";

        try
        {
            manager.Open();
            manager.ProviderType = DataProvider.SqlServer;

            manager.BeginTransaction();

            //int BranchID = (Int32)manager.ExecuteScalar(CommandType.Text, "SELECT MAX(BranchID) FROM tblOfficeBranches");
            //  DateTime completedDate = request.CompletedDate != null ? request.CompletedDate.GetValueOrDefault().ToString("yyyy-MM-dd") : "null";
            DateTime completedDate = DateTime.Now;

            dbQry = string.Format("UPDATE tblInternalTransferRequests SET CompletedUser='******', CompletedDate='{1}', Status='{2}' Where RequestID={3}",
                                  request.CompletedUser, completedDate.ToString("yyyy-MM-dd"), Status, request.RequestID);

            //dbQry = "Insert into tblUserRole(UserName, Role) VALUES('Prashanth', 'Test')";

            manager.ExecuteNonQuery(CommandType.Text, dbQry.ToString());

            string mac2 = string.Empty;
            if (System.Web.HttpContext.Current.Session["macAddress"] == null)
            {
                mac2 = "Contact Administrator";
            }
            else
            {
                mac2 = System.Web.HttpContext.Current.Session["macAddress"].ToString();
            }

            sAuditStr = "Internal Transfer Approval : Itemcode : " + request.ItemCode + " added. Record Details :  User :"******" Requested Branch :" + request.RequestedBranch + " Branch Has Stock :" + request.BranchHasStock + " Status :" + Status + " Qty :" + request.Quantity + " completed user :"******" Time: " + DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss") + " MacAddress:" + mac2;
            dbQry     = string.Format("INSERT INTO  tblAudit(Description,Command,auditdate) VALUES('{0}','{1}','{2}')", sAuditStr, "Rejected", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            manager.ExecuteNonQuery(CommandType.Text, dbQry);

            manager.CommitTransaction();
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            manager.Dispose();
        }
    }
コード例 #3
0
        /// <summary>
        /// Internal transfer funds between two wallet. For use, must authorize User
        /// </summary>
        /// <param name="sourceId">Wallet source UUID identificator.</param>
        /// <param name="destinationId">Wallet destination UUID identificator.</param>
        /// <param name="currencyCode">Currency market code.</param>
        /// <param name="funds">Amount of funds to transfer.</param>
        /// <returns>Transfer data, confirmation.</returns>
        public InternalTransfer InternalTransfer(string sourceId, string destinationId, string currencyCode, decimal funds)
        {
            RestClient rc = new RestClient(config.ApiDoubleBalancesUrl + "/transfer/" + sourceId + "/" + destinationId);

            InternalTransferRequest itr = new InternalTransferRequest(currencyCode, funds);

            rc.AddOwnHeaderToRequest(new AutorizeData(config));
            rc.SendPOST(itr);

            return(Tools.TryGetResponse <InternalTransfer>(rc));
        }
コード例 #4
0
    public InternalTransferRequest GetInternalTransferRequest(string connection, int RequestID)
    {
        DataSet       dsData = new DataSet();
        StringBuilder dbQry  = new StringBuilder();
        List <InternalTransferRequest> list = new List <InternalTransferRequest>();

        try
        {
            string sDataSource = CreateConnectionString(connection);

            DBManager manager = new DBManager(DataProvider.SqlServer);
            manager.ConnectionString = sDataSource;

            manager.Open();


            dbQry.AppendFormat("SELECT RequestID, UserID, RequestedDate, ItemCode, RequestedBranch, BranchHasStock, Status, Quantity, RejectedReason, CompletedDate, CompletedUser FROM tblInternalTransferRequests Where RequestID={0}", RequestID);


            dsData = manager.ExecuteDataSet(CommandType.Text, dbQry.ToString());
            if (dsData != null)
            {
                if (dsData.Tables[0].Rows.Count > 0)
                {
                    DataRow item = dsData.Tables[0].Rows[0];
                    InternalTransferRequest newRequest = new InternalTransferRequest();
                    newRequest.RequestID       = item.Field <int>("RequestID");
                    newRequest.UserID          = item["UserID"].ToString();
                    newRequest.RequestedDate   = item.Field <DateTime>("RequestedDate");
                    newRequest.ItemCode        = item["ItemCode"].ToString();
                    newRequest.Quantity        = item["Quantity"].ToString() != "" ? Convert.ToDecimal(item["Quantity"].ToString()) : 0;
                    newRequest.RequestedBranch = item["RequestedBranch"].ToString();
                    newRequest.RejectedReason  = item["RejectedReason"].ToString();
                    newRequest.CompletedUser   = item["CompletedUser"].ToString();
                    newRequest.Status          = item["Status"].ToString();
                    newRequest.CompletedDate   = item.Field <DateTime?>("CompletedDate");
                    newRequest.BranchHasStock  = item["BranchHasStock"].ToString();

                    return(newRequest);
                }
            }
        }
        catch (Exception ex)
        {
            //ObjNLog.Error(string.Format("Exception Raised {0}", ex.Message));
            throw ex;
        }

        return(null);
    }
コード例 #5
0
    public void ApproveInternalTrasfer(string connection, InternalTransferRequest request)
    {
        string sDataSource = CreateConnectionString(connection);

        DBManager manager = new DBManager(DataProvider.SqlServer);

        manager.ConnectionString = sDataSource.ToLower();
        DataSet ds    = new DataSet();
        string  dbQry = string.Empty;

        string  dbQ       = string.Empty;
        DataSet dsd       = new DataSet();
        string  sAuditStr = string.Empty;

        try
        {
            manager.Open();
            manager.ProviderType = DataProvider.SqlServer;

            manager.BeginTransaction();

            //int BranchID = (Int32)manager.ExecuteScalar(CommandType.Text, "SELECT MAX(BranchID) FROM tblOfficeBranches");
            string completedDate = request.CompletedDate != null?request.CompletedDate.GetValueOrDefault().ToString("yyyy-MM-dd") : "null";

            dbQry = string.Format("UPDATE tblInternalTransferRequests SET CompletedUser='******', CompletedDate='{1}', Status='{2}' Where RequestID={3}",
                                  request.CompletedUser, completedDate, request.Status, request.RequestID);

            //dbQry = "Insert into tblUserRole(UserName, Role) VALUES('Prashanth', 'Test')";

            manager.ExecuteNonQuery(CommandType.Text, dbQry.ToString());



            string savesap = string.Empty;
            dbQ = "SELECT KeyValue From tblSettings WHERE KEYNAME='SAPPROCESS'";
            dsd = manager.ExecuteDataSet(CommandType.Text, dbQ.ToString());
            if (dsd.Tables[0].Rows.Count > 0)
            {
                savesap = dsd.Tables[0].Rows[0]["KeyValue"].ToString();
            }

            if (savesap == "YES")
            {
                int    Unique       = 0;
                object retUniqueKey = manager.ExecuteScalar(CommandType.Text, "SELECT MAX(UniqueKey) FROM SAPOUT");

                if ((retUniqueKey != null) && (retUniqueKey != DBNull.Value))
                {
                    Unique = Convert.ToInt32(manager.ExecuteScalar(CommandType.Text, "SELECT MAX(UniqueKey) FROM SAPOUT"));
                    Unique = Unique + 1;
                }
                else
                {
                    Unique = 1;
                }

                string xmldata = "";
                xmldata = xmldata + "<InternalTransfer><Date>" + Convert.ToDateTime(completedDate).ToString("yyyyMMdd") + "</Date><ReqID>" + request.RequestID + "</ReqID><ReqUser>" + request.CompletedUser + "</ReqUser><ProductCode>" + request.ItemCode + "</ProductCode><Quantity>" + request.Quantity + "</Quantity><RequestingBranch>" + request.RequestedBranch + "</RequestingBranch><RequestedBranch>" + request.BranchHasStock + "</RequestedBranch><UniqueKey>" + Unique + "</UniqueKey></InternalTransfer>";

                dbQry = string.Format("INSERT INTO SAPOUT(EntryCreateDateTime,TroyTransNo,ObjName,XMLData,UniqueKey) VALUES('{0}',{1},'{2}','{3}',{4})",
                                      DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), request.RequestID, "InternalTransfer", xmldata, Unique);

                manager.ExecuteNonQuery(CommandType.Text, dbQry);
            }

            string mac2 = string.Empty;
            if (System.Web.HttpContext.Current.Session["macAddress"] == null)
            {
                mac2 = "Contact Administrator";
            }
            else
            {
                mac2 = System.Web.HttpContext.Current.Session["macAddress"].ToString();
            }

            sAuditStr = "Internal Transfer Approval : Itemcode : " + request.ItemCode + " added. Record Details :  User :"******" Requested Branch :" + request.RequestedBranch + " Branch Has Stock :" + request.BranchHasStock + " Status :" + request.Status + " Qty :" + request.Quantity + " completed user :"******" Time: " + DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss") + " MacAddress:" + mac2;
            dbQry     = string.Format("INSERT INTO  tblAudit(Description,Command,auditdate) VALUES('{0}','{1}','{2}')", sAuditStr, "Approved", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            manager.ExecuteNonQuery(CommandType.Text, dbQry);



            manager.CommitTransaction();
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            manager.Dispose();
        }
    }
コード例 #6
0
    public List <InternalTransferRequest> ListInternalRequests1(string connection, string txtSearch, string dropDown, string branch)
    {
        DataSet       dsData = new DataSet();
        StringBuilder dbQry  = new StringBuilder();
        List <InternalTransferRequest> list = new List <InternalTransferRequest>();

        try
        {
            string sDataSource = CreateConnectionString(connection);

            DBManager manager = new DBManager(DataProvider.SqlServer);
            manager.ConnectionString = sDataSource;

            manager.Open();

            if (!(dropDown == "ItemCode" || dropDown == "Status" || dropDown == "RequestedBranch" || dropDown == "CompletedDate" || dropDown == "BranchHasStock" || dropDown == "RequestID" || dropDown == "UserID" || dropDown == "RequestedDate"))
            {
                txtSearch = "%" + txtSearch + "%";
            }


            if (branch == "All")
            {
                dbQry.Append("SELECT RequestID, UserID, RequestedDate, ItemCode, RequestedBranch, BranchHasStock, Status, Quantity, RejectedReason, CompletedDate, CompletedUser FROM tblInternalTransferRequests ");

                if (dropDown == "ItemCode" && !string.IsNullOrEmpty(txtSearch))
                {
                    dbQry.AppendFormat("Where ItemCode = '{0}' ", txtSearch);
                }
                else if (dropDown == "Status" && !string.IsNullOrEmpty(txtSearch))
                {
                    dbQry.AppendFormat("Where Status = '{0}' ", txtSearch);
                }
                else if (dropDown == "RequestedBranch" && !string.IsNullOrEmpty(txtSearch))
                {
                    dbQry.AppendFormat("Where RequestedBranch = '{0}' ", txtSearch);
                }
                else if (dropDown == "CompletedDate" && !string.IsNullOrEmpty(txtSearch))
                {
                    dbQry.AppendFormat("Where CompletedDate = '{0}' ", Convert.ToDateTime(txtSearch).ToString("yyyy-MM-dd"));
                }
                else if (dropDown == "BranchHasStock" && !string.IsNullOrEmpty(txtSearch))
                {
                    dbQry.AppendFormat("Where BranchHasStock = '{0}' ", txtSearch);
                }
                else if (dropDown == "UserID" && !string.IsNullOrEmpty(txtSearch))
                {
                    dbQry.AppendFormat("Where UserID = '{0}' ", txtSearch);
                }
                else if (dropDown == "RequestID" && !string.IsNullOrEmpty(txtSearch))
                {
                    dbQry.AppendFormat("Where RequestID = '{0}' ", txtSearch);
                }
                else if (dropDown == "RequestedDate" && !string.IsNullOrEmpty(txtSearch))
                {
                    dbQry.AppendFormat("Where RequestedDate = '{0}' ", Convert.ToDateTime(txtSearch).ToString("yyyy-MM-dd"));
                }
            }
            else
            {
                dbQry.Append("SELECT RequestID, UserID, RequestedDate, ItemCode, RequestedBranch, BranchHasStock, Status, Quantity, RejectedReason, CompletedDate, CompletedUser FROM tblInternalTransferRequests where BranchHasStock='" + branch + "'  ");

                if (dropDown == "ItemCode" && !string.IsNullOrEmpty(txtSearch))
                {
                    dbQry.AppendFormat("and ItemCode = '{0}' ", txtSearch);
                }
                else if (dropDown == "Status" && !string.IsNullOrEmpty(txtSearch))
                {
                    dbQry.AppendFormat("and Status = '{0}' ", txtSearch);
                }
                else if (dropDown == "RequestedBranch" && !string.IsNullOrEmpty(txtSearch))
                {
                    dbQry.AppendFormat("and RequestedBranch = '{0}' ", txtSearch);
                }
                else if (dropDown == "CompletedDate" && !string.IsNullOrEmpty(txtSearch))
                {
                    dbQry.AppendFormat("and CompletedDate = '{0}' ", Convert.ToDateTime(txtSearch).ToString("yyyy-MM-dd"));
                }
                else if (dropDown == "BranchHasStock" && !string.IsNullOrEmpty(txtSearch))
                {
                    dbQry.AppendFormat("and BranchHasStock = '{0}' ", txtSearch);
                }
                else if (dropDown == "UserID" && !string.IsNullOrEmpty(txtSearch))
                {
                    dbQry.AppendFormat("and UserID = '{0}' ", txtSearch);
                }
                else if (dropDown == "RequestID" && !string.IsNullOrEmpty(txtSearch))
                {
                    dbQry.AppendFormat("and RequestID = '{0}' ", txtSearch);
                }
                else if (dropDown == "RequestedDate" && !string.IsNullOrEmpty(txtSearch))
                {
                    dbQry.AppendFormat("and RequestedDate = '{0}' ", Convert.ToDateTime(txtSearch).ToString("yyyy-MM-dd"));
                }
            }



            dbQry.Append(" Order By Status desc,RequestedDate desc ");

            dsData = manager.ExecuteDataSet(CommandType.Text, dbQry.ToString());
            if (dsData != null)
            {
                if (dsData.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow item in dsData.Tables[0].Rows)
                    {
                        InternalTransferRequest newRequest = new InternalTransferRequest();
                        newRequest.RequestID       = item.Field <int>("RequestID");
                        newRequest.UserID          = item["UserID"].ToString();
                        newRequest.RequestedDate   = item.Field <DateTime>("RequestedDate");
                        newRequest.ItemCode        = item["ItemCode"].ToString();
                        newRequest.Quantity        = item["Quantity"].ToString() != "" ? Convert.ToDecimal(item["Quantity"].ToString()) : 0;
                        newRequest.RequestedBranch = item["RequestedBranch"].ToString();
                        newRequest.RejectedReason  = item["RejectedReason"].ToString();
                        newRequest.CompletedUser   = item["CompletedUser"].ToString();
                        newRequest.Status          = item["Status"].ToString();
                        newRequest.CompletedDate   = item.Field <DateTime?>("CompletedDate");
                        newRequest.BranchHasStock  = item["BranchHasStock"].ToString();

                        list.Add(newRequest);
                    }
                }
            }

            return(list);
        }
        catch (Exception ex)
        {
            //ObjNLog.Error(string.Format("Exception Raised {0}", ex.Message));
            throw ex;
        }
    }
コード例 #7
0
    protected void InsertButton_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            try
            {
                string connection = Request.Cookies["Company"].Value;
                string UserID     = Request.Cookies["LoggedUserName"].Value;

                InternalTransferRequest  request = new InternalTransferRequest();
                IInternalTransferService bl      = new BusinessLogic(connection);

                if (cmbRequestedBranch.SelectedValue == cmbBranchHasStock.SelectedValue)
                {
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Request branch and Branch has stock cannot be same.');", true);
                    ModalPopupExtender1.Show();
                    return;
                }

                if (cmbProd.SelectedValue != "0")
                {
                    request.ItemCode = cmbProd.SelectedValue;
                }
                if (cmbRequestedBranch.SelectedValue != "0")
                {
                    request.RequestedBranch = cmbRequestedBranch.SelectedValue;
                }
                if (cmbBranchHasStock.SelectedValue != "0")
                {
                    request.BranchHasStock = cmbBranchHasStock.SelectedValue;
                }

                if (cmbStatus.SelectedValue != "0")
                {
                    request.Status = cmbStatus.SelectedValue;
                }

                if (!string.IsNullOrEmpty(txtRequestedDate.Text))
                {
                    request.RequestedDate = Convert.ToDateTime(txtRequestedDate.Text);
                }

                if (!string.IsNullOrEmpty(txtQtyAdd.Text))
                {
                    request.Quantity = Convert.ToDecimal(txtQtyAdd.Text);
                }

                request.UserID = UserID;

                bl.RaiseInternalTrasfer(connection, request);

                ModalPopupExtender1.Hide();

                BindGridData();

                contentPopUp.Visible = false;

                ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Internal Transfer Request Saved Successfully.');", true);
            }
            catch (Exception ex)
            {
                TroyLiteExceptionManager.HandleException(ex);
            }
        }
    }
コード例 #8
0
    protected void SaveCommentsButton_Click(object sender, EventArgs e)
    {
        DataSet paymentdata = null;

        if (cmbApproveReject.SelectedValue == "Approve")
        {
            string connection = Request.Cookies["Company"].Value;
            string UserID     = Request.Cookies["LoggedUserName"].Value;

            string RequestID = hdRequestID.Value;
            int    iSupplier = 0;
            int    iCustomer = 0;

            int    iPaymode   = 1;
            string sInvoiceno = string.Empty;

            IInternalTransferService transferService = new BusinessLogic(connection);
            InternalTransferRequest  request         = transferService.GetInternalTransferRequest(connection, int.Parse(RequestID));

            BusinessLogic branchHasStockService  = new BusinessLogic(connection);
            BusinessLogic branchRequestedService = new BusinessLogic(connection);

            BusinessLogic bl = new BusinessLogic(connection);

            string BillingMethod = bl.getConfigInfoMethod();

            if (transferService.CheckIftheItemHasStock(connection, request.ItemCode, request.BranchHasStock, request.Quantity))
            {
                iCustomer = transferService.GetCustomerIDForBranchCode(connection, request.BranchHasStock);
                iSupplier = transferService.GetSupplierIDForBranchCode(connection, request.BranchHasStock);
                DataSet customer   = transferService.GeBranchHasStockCustomerID(connection, request.BranchHasStock, iCustomer);
                DataSet executives = transferService.GeBranchHasStockExecutives(connection, request.BranchHasStock);
                DataSet supplier   = transferService.GetRequestedBranchSupplierID(connection, request.BranchHasStock, iSupplier);

                if (customer != null && executives != null)
                {
                    string dispatchFrom = request.BranchHasStock + " Internal Trasfer";


                    //DataSet prodData = branchHasStockService.GetProductForId(connection, request.ItemCode);

                    //iCustomer = transferService.GetCustomerIDForBranchCode(connection, request.BranchHasStock);

                    DataSet customerInfo = bl.GetExecutive(iCustomer);

                    DataSet prodData = bl.ListSalesProductPriceDetails(request.ItemCode, customerInfo.Tables[0].Rows[0]["LedgerCategory"].ToString(), request.BranchHasStock);

                    DataSet ds = GetProductDetails(request.ItemCode, request.BranchHasStock, request.Quantity, BillingMethod, prodData);

                    int billNo = branchHasStockService.InsertSalesNewSeries("", DateTime.Now.ToShortDateString(), iSupplier,
                                                                            supplier.Tables[0].Rows[0]["LedgerName"].ToString(), "", "", 3, "", 0, 0.0, "NO", "", 0.0,
                                                                            0.0, ds, "", "YES", null, "NO", "NO", "", "", executives.Tables[0].Rows[0]["empFirstName"].ToString(), dispatchFrom, 0, 0, 0.0, UserID, "NO",
                                                                            "NO", "VAT EXCLUSIVE", "Internal Transfer", "N", "Y", "0", "Others", "PERCENTAGE", 0, request.BranchHasStock, connection, "NO", 0, "", "", "", "", false);



                    branchRequestedService.InsertPurchase(billNo.ToString(), DateTime.Now, iCustomer, iPaymode, string.Empty, 0, 0, "NO", "", 0, 0, 0, "YES", ds, "NO", sInvoiceno, DateTime.Now, 0, 0, 0, 0, UserID, "Internal transfer", billNo, request.BranchHasStock, connection, "NO", paymentdata, "", "", "", "", "", "", false);

                    request.CompletedDate = DateTime.Now;
                    request.CompletedUser = UserID;
                    request.Status        = "Completed";

                    transferService.ApproveInternalTrasfer(connection, request);
                    modalPopupApproveReject.Hide();
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Internal Transfer Completed Successfully.');", true);
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Insufficent stock, please check the Branch if it has sufficient stock available.');", true);
            }

            BindGridData();
        }
    }
コード例 #9
0
    protected void GrdViewRequestes_SelectedIndexChanged(object sender, EventArgs e)
    {
        //try
        //{
        //    GridViewRow Row = GrdViewRequestes.SelectedRow;
        //    string connection = Request.Cookies["Company"].Value;
        //    IInternalTransferService bl = new BusinessLogic(connection, connection);

        //    int ID = Convert.ToInt32(GrdViewRequestes.SelectedDataKey.Value);
        //    UpdateButton.Visible = true;
        //    InsertButton.Visible = false;
        //    contentPopUp.Visible = true;
        //    cmbStatus.Enabled = false;
        //    txtCompletedDate.Enabled = false;
        //    txtReason.Enabled = false;

        //    //GrdViewBranches.Visible = false;

        //    InternalTransferRequest requestDetail = bl.GetInternalTransferRequest(ID);

        //    if (requestDetail != null)
        //    {
        //        hdRequestID.Value = ID.ToString();

        //        txtRequestedDate.Text = requestDetail.RequestedDate.ToShortDateString();
        //        if (cmbProd.Items.FindByValue(requestDetail.ItemCode) != null)
        //            cmbProd.SelectedValue = requestDetail.ItemCode;

        //        if (cmbRequestedBranch.Items.FindByValue(requestDetail.RequestedBranch) != null)
        //            cmbRequestedBranch.SelectedValue = requestDetail.RequestedBranch;

        //        if (cmbBranchHasStock.Items.FindByValue(requestDetail.BranchHasStock) != null)
        //            cmbBranchHasStock.SelectedValue = requestDetail.BranchHasStock;

        //        if (cmbStatus.Items.FindByValue(requestDetail.Status) != null)
        //            cmbStatus.SelectedValue = requestDetail.Status;

        //        txtReason.Text = requestDetail.RejectedReason;

        //        txtQtyAdd.Text = requestDetail.Quantity.ToString();

        //        if (requestDetail.CompletedDate.HasValue)
        //           txtCompletedDate.Text = requestDetail.CompletedDate.ToString();

        //        ModalPopupExtender1.Show();
        //    }
        //}
        //catch (Exception ex)
        //{
        //    TroyLiteExceptionManager.HandleException(ex);
        //}
        try
        {
            GridViewRow Row             = GrdViewRequestes.SelectedRow;
            string      connection      = Request.Cookies["Company"].Value;
            IInternalTransferService bl = new BusinessLogic(connection);

            int ID = Convert.ToInt32(GrdViewRequestes.SelectedDataKey.Value);
            UpdateButton.Visible     = true;
            InsertButton.Visible     = false;
            contentPopUp.Visible     = true;
            cmbStatus.Enabled        = false;
            txtCompletedDate.Enabled = false;
            txtReason.Enabled        = false;
            BranchEnable_Disable();

            //GrdViewBranches.Visible = false;

            InternalTransferRequest requestDetail = bl.GetInternalTransferRequest(connection, ID);

            if (requestDetail != null)
            {
                hdRequestID.Value = ID.ToString();

                txtRequestedDate.Text = requestDetail.RequestedDate.ToShortDateString();
                if (cmbProd.Items.FindByValue(requestDetail.ItemCode) != null)
                {
                    cmbProd.SelectedValue = requestDetail.ItemCode;
                }

                if (cmbRequestedBranch.Items.FindByValue(requestDetail.RequestedBranch) != null)
                {
                    cmbRequestedBranch.SelectedValue = requestDetail.RequestedBranch;
                }

                if (cmbBranchHasStock.Items.FindByValue(requestDetail.BranchHasStock) != null)
                {
                    cmbBranchHasStock.SelectedValue = requestDetail.BranchHasStock;
                }

                if (cmbStatus.Items.FindByValue(requestDetail.Status) != null)
                {
                    cmbStatus.SelectedValue = requestDetail.Status;
                }

                txtReason.Text = requestDetail.RejectedReason;

                txtQtyAdd.Text = requestDetail.Quantity.ToString();

                if (requestDetail.CompletedDate.HasValue)
                {
                    txtCompletedDate.Text = requestDetail.CompletedDate.ToString();
                }


                BusinessLogic bll = new BusinessLogic(connection);

                string itemCode = cmbProd.SelectedValue;

                double Reqchk = bll.getStockInfo(itemCode, cmbRequestedBranch.SelectedValue);
                double Haschk = bll.getStockInfo(itemCode, cmbBranchHasStock.SelectedValue);

                txtReqStock.Text = Reqchk.ToString();
                txtHasStock.Text = Haschk.ToString();
                UpdatePanel1.Update();
                UpdatePanel2.Update();


                ModalPopupExtender1.Show();
            }
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
コード例 #10
0
    protected void GrdViewRequestes_SelectedIndexChanged(object sender, EventArgs e)
    {
        //try
        //{
        //    GridViewRow Row = GrdViewRequestes.SelectedRow;
        //    string connection = Request.Cookies["Company"].Value;
        //    IInternalTransferService bl = new BusinessLogic(connection, connection);

        //    int ID = Convert.ToInt32(GrdViewRequestes.SelectedDataKey.Value);
        //    UpdateButton.Visible = true;
        //    InsertButton.Visible = false;
        //    contentPopUp.Visible = true;
        //    cmbStatus.Enabled = false;
        //    txtCompletedDate.Enabled = false;
        //    txtReason.Enabled = false;

        //    //GrdViewBranches.Visible = false;

        //    InternalTransferRequest requestDetail = bl.GetInternalTransferRequest(ID);

        //    if (requestDetail != null)
        //    {
        //        hdRequestID.Value = ID.ToString();

        //        txtRequestedDate.Text = requestDetail.RequestedDate.ToShortDateString();
        //        if (cmbProd.Items.FindByValue(requestDetail.ItemCode) != null)
        //            cmbProd.SelectedValue = requestDetail.ItemCode;

        //        if (cmbRequestedBranch.Items.FindByValue(requestDetail.RequestedBranch) != null)
        //            cmbRequestedBranch.SelectedValue = requestDetail.RequestedBranch;

        //        if (cmbBranchHasStock.Items.FindByValue(requestDetail.BranchHasStock) != null)
        //            cmbBranchHasStock.SelectedValue = requestDetail.BranchHasStock;

        //        if (cmbStatus.Items.FindByValue(requestDetail.Status) != null)
        //            cmbStatus.SelectedValue = requestDetail.Status;

        //        txtReason.Text = requestDetail.RejectedReason;

        //        txtQtyAdd.Text = requestDetail.Quantity.ToString();

        //        if (requestDetail.CompletedDate.HasValue)
        //           txtCompletedDate.Text = requestDetail.CompletedDate.ToString();

        //        ModalPopupExtender1.Show();
        //    }
        //}
        //catch (Exception ex)
        //{
        //    TroyLiteExceptionManager.HandleException(ex);
        //}


        //    btnSaveComments.Enabled = true;

        BindDropdowns();

        string        connection = Request.Cookies["Company"].Value;
        BusinessLogic bll        = new BusinessLogic(connection);

        int ID = Convert.ToInt32(GrdViewRequestes.SelectedDataKey.Value);

        IInternalTransferService bl = new BusinessLogic(connection);

        InternalTransferRequest requestDetail = bl.GetInternalTransferRequest(connection, ID);

        if (requestDetail != null)
        {
            TextBox3.Text = requestDetail.RequestedDate.ToShortDateString();
            if (DropDownList1.Items.FindByValue(requestDetail.ItemCode) != null)
            {
                DropDownList1.SelectedValue = requestDetail.ItemCode;
            }

            if (DropDownList2.Items.FindByValue(requestDetail.RequestedBranch) != null)
            {
                DropDownList2.SelectedValue = requestDetail.RequestedBranch;
            }

            if (DropDownList3.Items.FindByValue(requestDetail.BranchHasStock) != null)
            {
                DropDownList3.SelectedValue = requestDetail.BranchHasStock;
            }

            if (DropDownList4.Items.FindByValue(requestDetail.Status) != null)
            {
                DropDownList4.SelectedValue = requestDetail.Status;
            }

            TextBox2.Text = requestDetail.RejectedReason;

            TextBox1.Text = requestDetail.Quantity.ToString();

            if (requestDetail.CompletedDate.HasValue)
            {
                TextBox4.Text = requestDetail.CompletedDate.ToString();
            }



            string itemCode = DropDownList1.SelectedValue;

            double Reqchk = bll.getStockInfo(itemCode, DropDownList2.SelectedValue);
            double Haschk = bll.getStockInfo(itemCode, DropDownList3.SelectedValue);

            txtReqStock.Text = Reqchk.ToString();
            txtHasStock.Text = Haschk.ToString();
            UpdatePanel1.Update();
            UpdatePanel2.Update();
        }



        //frmViewAdd.Visible = true;
        //frmViewAdd.ChangeMode(FormViewMode.Edit);
        //GrdViewBranches.Columns[8].Visible = false;
        //lnkBtnAdd.Visible = false;
        modalPopupApproveReject.Show();

        //GridViewRow row = (GridViewRow)((Control)e.CommandSource).NamingContainer;

        GridViewRow row = GrdViewRequestes.SelectedRow;

        int rowIndex = row.RowIndex;

        hdRequestID.Value = GrdViewRequestes.DataKeys[rowIndex].Value.ToString();
        //if (frmViewAdd.CurrentMode == FormViewMode.Edit)
        //    Accordion1.SelectedIndex = 1;
    }