Пример #1
0
 protected void ASPxGridView1_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
 {
     if (Request.QueryString["Sn"] != null)
     {
         string soNo = SafeValue.SafeString(Request.QueryString["sn"].ToString());
         string type = SafeValue.SafeString(Request.QueryString["typ"].ToString());
         string whId = SafeValue.SafeString(Request.QueryString["whId"].ToString());
         try
         {
             for (int i = 0; i < list.Count; i++)
             {
                 string sku  = list[i].sku;
                 int    qty1 = list[i].qty1;
                 //int qty2 = list[i].qty2;
                 //int qty3 = list[i].qty3;
                 decimal price = list[i].price;
                 decimal amt   = SafeValue.SafeDecimal(qty1 * price);
                 string  lotNo = list[i].lotNo;
                 TransferToDo(soNo, sku, type, qty1, price, amt, whId, lotNo);
                 //if(whId.ToUpper()=="DROPSHIP"){
                 //  TransferToPoRequest(soNo, sku, qty1, price);
                 //}
             }
             e.Result = "Success";
         }
         catch { }
     }
     else
     {
         e.Result = "Please keyin select party ";
     }
 }
    protected void ASPxGridView1_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
    {
        if (Request.QueryString["Sn"] != null)
        {
            string poNo = Request.QueryString["Sn"].ToString();

            try
            {
                for (int i = 0; i < list.Count; i++)
                {
                    string  poRequestId = list[i].sku;
                    int     qty1        = list[i].qty1;
                    int     qty2        = list[i].qty2;
                    int     qty3        = list[i].qty3;
                    decimal price       = list[i].price;
                    string  lotNo       = list[i].lotNo;
                    decimal amt         = SafeValue.SafeDecimal(qty1 * price);
                    TransferToPo(poNo, qty1, qty2, qty3, price, lotNo, poRequestId, amt);
                }
                e.Result = "";
            }
            catch { }
        }
        else
        {
            e.Result = "Please keyin select party ";
        }
    }
    protected void ASPxGridView1_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
    {
        string s = e.Parameters;

        if (s == "OK")
        {
            try
            {
                for (int i = 0; i < list.Count; i++)
                {
                    string   partyId  = list[i].partyId;
                    string   sku      = list[i].sku;
                    string   des      = list[i].des;
                    decimal  price1   = list[i].price1;
                    DateTime fromDate = list[i].fromDate;
                    TransferToDo(partyId, sku, des, price1, fromDate);
                }
                e.Result = "Success";
            }
            catch { }
        }
        else
        {
            e.Result = "Please keyin select party ";
        }
    }
Пример #4
0
    protected void grid_Transport_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
    {
        string pars = e.Parameters;

        string[] ar = pars.Split('_');
        if (ar.Length >= 2)
        {
            if (ar[0].Equals("NewTripInLine"))
            {
                NewTrip_inLine(e, SafeValue.SafeInt(ar[1], -1), ar[2]);
            }
            if (ar[0].Equals("OpenDetail"))
            {
                OpenDetail_GetData(e, SafeValue.SafeInt(ar[1], -1));
            }
            if (ar[0].Equals("UpdateInline"))
            {
                Update_Inline(e, SafeValue.SafeInt(ar[1], -1));
            }
            if (ar[0].Equals("ContChangeStatus"))
            {
                ContainerChangeStatus(e, SafeValue.SafeInt(ar[1], -1));
            }
        }
    }
Пример #5
0
 protected void grid_Transport_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
 {
     if (e.Parameters == "OK")
     {
         //string DriverCode = btn_DriveCode.Text.Trim();
         //if (DriverCode.Length == 0)
         //{
         //    e.Result = "Driver Code is request";
         //    return;
         //}
         int update_error_rowcount = 0;
         for (int i = 0; i < list.Count; i++)
         {
             try
             {
                 if (check_Trip_Status(list[i].Id, list[i].DriverCode, list[i].Statuscode))
                 {
                     update_error_rowcount++;
                     continue;
                 }
                 string sql = string.Format(@"update CTM_JobDet2 set DriverCode='{0}',TowheadCode='{2}',CfsCode='{3}',ChessisCode='{4}',SubletFlag='{5}',SubletHauliername='{6}',BayCode='{7}' where Id='{1}'", list[i].DriverCode, list[i].jobNo, list[i].TowheadCode, list[i].CfsCode, list[i].ChessisCode, list[i].subletFlag, list[i].subletHaulierName, list[i].BayCode);
                 ConnectSql.ExecuteSql(sql);
             }
             catch { }
         }
         if (update_error_rowcount > 0)
         {
             e.Result = update_error_rowcount + " Rows Update is Error";
         }
     }
 }
Пример #6
0
 protected void grid_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
 {
     if (e.Parameters == "VisSel")
     {
         e.Result = GetVisibleSelectedRowCount();
     }
 }
Пример #7
0
 protected void ASPxGridView1_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
 {
     if (Request.QueryString["no"] != null)
     {
         string soNo = Request.QueryString["no"].ToString();
         try
         {
             for (int i = 0; i < list.Count; i++)
             {
                 string doDetId = list[i].doDetId;
                 int    qty1    = list[i].qty1;
                 int    qty2    = list[i].qty2;
                 int    qty3    = list[i].qty3;
                 string toLoc   = list[i].toLoc;
                 Transfer(soNo, doDetId, qty1, qty2, qty3, toLoc);
             }
             e.Result = "Success";
         }
         catch { }
     }
     else
     {
         e.Result = "Please keyin select party ";
     }
 }
Пример #8
0
 protected void ASPxGridView1_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
 {
     if (Request.QueryString["Sn"] != null)
     {
         string doNo   = Request.QueryString["Sn"].ToString();
         string doType = SafeValue.SafeString(Request.QueryString["typ"]);//so or po
         if (doType.ToLower() == "so")
         {
             doType = "OUT";
         }
         else
         {
             doType = "IN";
         }
         try
         {
             for (int i = 0; i < list.Count; i++)
             {
                 string skuId = list[i].skuId;
                 int    qty1  = list[i].qty1;
                 int    qty2  = list[i].qty2;
                 int    qty3  = list[i].qty3;
                 InsertDoDet(skuId, doNo, doType, qty1, qty2, qty3);
             }
             e.Result = "";
         }
         catch { }
     }
     else
     {
         e.Result = "Please keyin select party ";
     }
 }
Пример #9
0
    protected void ASPxGridView1_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
    {
        if (Request.QueryString["Sn"] != null)
        {
            string doNo = SafeValue.SafeString(Request.QueryString["Sn"].ToString());
            string type = SafeValue.SafeString(Request.QueryString["type"].ToString());
            string whId = SafeValue.SafeString(Request.QueryString["WhId"].ToString());
            try
            {
                for (int i = 0; i < list.Count; i++)
                {
                    int    id    = SafeValue.SafeInt(list[i].id, 0);
                    string sku   = list[i].sku;
                    int    qty1  = list[i].qty1;
                    string lotNo = list[i].lotNo;
                    TransferToDo(doNo, sku, lotNo, qty1, whId, id);

                    string sql = string.Format(@"update Wh_DoDet set Qty1=Qty5,Qty5=0,JobStatus='Picked' where DoNo='{0}' and Qty5<>0", doNo);
                    ConnectSql.ExecuteSql(sql);
                }
                e.Result = "Success";
            }
            catch { }
        }
        else
        {
            e.Result = "Please keyin select party ";
        }
    }
Пример #10
0
 protected void ASPxGridView1_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
 {
     if (Request.QueryString["Sn"] != null)
     {
         string soNo = Request.QueryString["Sn"].ToString();
         try
         {
             for (int i = 0; i < list.Count; i++)
             {
                 string sku   = list[i].sku;
                 string lotNo = list[i].lotNo;
                 int    qty1  = list[i].qty1;
                 //int qty2 = list[i].qty2;
                 //int qty3 = list[i].qty3;
                 decimal price = list[i].price;
                 TransferToDo(soNo, sku, lotNo, qty1, price);
             }
             e.Result = "Success";
         }
         catch { }
     }
     else
     {
         e.Result = "Please keyin select party ";
     }
 }
Пример #11
0
    protected void ASPxGridView1_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
    {
        string dates = e.Parameters;

        string[] dateArr = dates.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
        if (dateArr.Length == list.Count)
        {
            try
            {
                e.Result = "Save success";
                for (int i = 0; i < list.Count; i++)
                {
                    string   docId   = list[i].docId;
                    bool     bankRec = list[i].bankRec;
                    string[] s1      = dateArr[i].Split('/');
                    //  DateTime d1 = new DateTime(SafeValue.SafeInt(s1[2], 0), SafeValue.SafeInt(s1[1], 0), SafeValue.SafeInt(s1[0], 0));

                    string bankDate = string.Format("{0}-{1}-{2}", SafeValue.SafeInt(s1[2], 0), SafeValue.SafeInt(s1[1], 0), SafeValue.SafeInt(s1[0], 0));

                    string sql = string.Format("Update XAArReceipt set BankRec='{0}',BankDate='{1}' where SequenceId='{2}'", bankRec ? "Y" : "N", bankDate, docId);
                    C2.Manager.ORManager.ExecuteCommand(sql);
                }
            }
            catch (Exception ex)
            {
                e.Result = ex.Message;
            }
        }
        else
        {
            e.Result = "Please reopen this page";
        }
    }
Пример #12
0
 protected void ASPxGridView1_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
 {
     if (Request.QueryString["Sn"] != null)
     {
         string doNo = Request.QueryString["Sn"].ToString();
         string type = Request.QueryString["typ"].ToString().ToLower();
         try
         {
             for (int i = 0; i < list.Count; i++)
             {
                 string skuId = list[i].skuId;
                 int    qty1  = list[i].qty1;
                 int    qty2  = list[i].qty2;
                 int    qty3  = list[i].qty3;
                 string loc   = list[i].loc;
                 if (type == "in")
                 {
                     InsertDoDet2(skuId, doNo, qty1, qty2, qty3, loc);//picklist
                 }
                 else
                 {
                     InsertDoDet2_out(skuId, doNo, qty1, qty2, qty3, loc);
                 }
             }
             UpdateDoDet2(doNo, "");
             e.Result = "";
         }
         catch { }
     }
     else
     {
         e.Result = "Please keyin select party ";
     }
 }
Пример #13
0
 protected void grid_Transport_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
 {
     if (e.Parameters == "OK")
     {
         int update_error_rowcount = 0;
         for (int i = 0; i < list.Count; i++)
         {
             try
             {
                 string id      = list[i].Id;
                 string driver  = list[i].diver;
                 string vehicle = list[i].vehicle;
                 string sql     = string.Format(@"update tpt_job set Driver='{1}',VehicleNo='{2}' where Id='{0}'", id, driver, vehicle);
                 ConnectSql.ExecuteSql(sql);
             }
             catch { }
         }
         if (update_error_rowcount > 0)
         {
             e.Result = update_error_rowcount + " Rows: Status is existing";
         }
         else
         {
             btn_Search_Click(null, null);
         }
     }
 }
Пример #14
0
    private void OpenDetail_GetData(DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e, int rowIndex)
    {
        if (rowIndex < 0)
        {
            e.Result = "Error";
            return;
        }
        TextBox   txt_tripId = this.grid_Transport.FindRowCellTemplateControl(rowIndex, (DevExpress.Web.ASPxGridView.GridViewDataColumn) this.grid_Transport.Columns["tripDetail"], "txt_tripId") as TextBox;
        string    sql        = string.Format(@"select * from ctm_jobdet2 where Id={0}", txt_tripId.Text);
        DataTable dt         = ConnectSql.GetTab(sql);

        if (dt.Rows.Count > 0)
        {
            string driver     = SafeValue.SafeString(dt.Rows[0]["DriverCode"]);
            string trailer    = SafeValue.SafeString(dt.Rows[0]["ChessisCode"]);
            string parkinglot = SafeValue.SafeString(dt.Rows[0]["ToParkingLot"]);
            string toaddress  = SafeValue.SafeString(dt.Rows[0]["ToCode"]);
            e.Result = "success:" + driver + "&,&" + trailer + "&,&" + parkinglot + "&,&" + toaddress;
        }
        else
        {
            e.Result = "Error:trip inexistence";
        }

        //e.Result = txt_tripId.Text;
    }
Пример #15
0
    protected void grid_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
    {
        int discount   = 0;
        int focusedRow = 0;

        string[] parameters = e.Parameters.Split('|');
        if (parameters.Length != 2)
        {
            return;
        }
        if (!int.TryParse(parameters[0], out focusedRow))
        {
            return;
        }
        if (!int.TryParse(parameters[1], out discount))
        {
            return;
        }
        if (discount < 0 || discount > 100)
        {
            return;
        }
        object[] values = (object[])grid.GetRowValues(focusedRow, "Quantity", "UnitPrice");
        if (values[0] == null || values[1] == null)
        {
            return;
        }
        int     quantity  = Convert.ToInt32(values[0]);
        decimal unitPrice = Convert.ToDecimal(values[1]);

        e.Result = string.Format("{0:c}", quantity * (unitPrice * (100 - discount) / 100));
    }
Пример #16
0
    private void Update_Inline(DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e, int rowIndex)
    {
        if (rowIndex < 0)
        {
            e.Result = "Save Error";
            return;
        }
        ASPxComboBox   cbb_statuscode  = this.grid_Transport.FindRowCellTemplateControl(rowIndex, null, "cbb_statuscode") as ASPxComboBox;
        TextBox        txt_tripId      = this.grid_Transport.FindRowCellTemplateControl(rowIndex, null, "txt_tripId") as TextBox;
        ASPxButtonEdit btn_DriverCode  = this.grid_Transport.FindRowCellTemplateControl(rowIndex, null, "btn_DriverCode") as ASPxButtonEdit;
        ASPxDateEdit   txt_FromDate    = this.grid_Transport.FindRowCellTemplateControl(rowIndex, null, "txt_FromDate") as ASPxDateEdit;
        ASPxTextBox    txt_FromTime    = this.grid_Transport.FindRowCellTemplateControl(rowIndex, null, "txt_FromTime") as ASPxTextBox;
        ASPxButtonEdit btn_ChessisCode = this.grid_Transport.FindRowCellTemplateControl(rowIndex, null, "btn_ChessisCode") as ASPxButtonEdit;
        ASPxButtonEdit txt_parkingLot  = this.grid_Transport.FindRowCellTemplateControl(rowIndex, null, "txt_parkingLot") as ASPxButtonEdit;
        ASPxMemo       txt_toAddress   = this.grid_Transport.FindRowCellTemplateControl(rowIndex, null, "txt_toAddress") as ASPxMemo;

        ASPxSpinEdit txt_Incentive1 = this.grid_Transport.FindRowCellTemplateControl(rowIndex, null, "txt_Incentive1") as ASPxSpinEdit;
        ASPxSpinEdit txt_Incentive2 = this.grid_Transport.FindRowCellTemplateControl(rowIndex, null, "txt_Incentive2") as ASPxSpinEdit;
        ASPxSpinEdit txt_Incentive3 = this.grid_Transport.FindRowCellTemplateControl(rowIndex, null, "txt_Incentive3") as ASPxSpinEdit;
        ASPxSpinEdit txt_Incentive4 = this.grid_Transport.FindRowCellTemplateControl(rowIndex, null, "txt_Incentive4") as ASPxSpinEdit;

        string sql = string.Format(@"select DriverCode from CTM_JobDet2 where Id=@Id");
        List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>();

        list.Add(new ConnectSql_mb.cmdParameters("@Id", txt_tripId.Text, SqlDbType.Int));
        string Driver_old = ConnectSql_mb.ExecuteScalar(sql, list).context;

        sql  = string.Format(@"update CTM_JobDet2 set Statuscode=@Statuscode,FromDate=@FromDate,FromTime=@FromTime,DriverCode=@DriverCode,ChessisCode=@ChessisCode,ToParkingLot=@ToParkingLot,ToCode=@ToCode,
Incentive1=@Incentive1,Incentive2=@Incentive2,Incentive3=@Incentive3,Incentive4=@Incentive4
where Id=@Id");
        list = new List <ConnectSql_mb.cmdParameters>();
        list.Add(new ConnectSql_mb.cmdParameters("@Id", txt_tripId.Text, SqlDbType.Int));
        list.Add(new ConnectSql_mb.cmdParameters("@Statuscode", SafeValue.SafeString(cbb_statuscode.Value, "P"), SqlDbType.NVarChar, 30));
        list.Add(new ConnectSql_mb.cmdParameters("@DriverCode", btn_DriverCode.Text, SqlDbType.NVarChar, 100));
        list.Add(new ConnectSql_mb.cmdParameters("@FromDate", txt_FromDate.Date, SqlDbType.Date));
        list.Add(new ConnectSql_mb.cmdParameters("@FromTime", txt_FromTime.Text, SqlDbType.NVarChar, 30));
        list.Add(new ConnectSql_mb.cmdParameters("@ChessisCode", btn_ChessisCode.Text, SqlDbType.NVarChar, 100));
        list.Add(new ConnectSql_mb.cmdParameters("@ToParkingLot", txt_parkingLot.Text, SqlDbType.NVarChar, 100));
        list.Add(new ConnectSql_mb.cmdParameters("@ToCode", txt_toAddress.Text, SqlDbType.NVarChar, 300));

        list.Add(new ConnectSql_mb.cmdParameters("@Incentive1", SafeValue.SafeDecimal(txt_Incentive1.Text), SqlDbType.Decimal));
        list.Add(new ConnectSql_mb.cmdParameters("@Incentive2", SafeValue.SafeDecimal(txt_Incentive2.Text), SqlDbType.Decimal));
        list.Add(new ConnectSql_mb.cmdParameters("@Incentive3", SafeValue.SafeDecimal(txt_Incentive3.Text), SqlDbType.Decimal));
        list.Add(new ConnectSql_mb.cmdParameters("@Incentive4", SafeValue.SafeDecimal(txt_Incentive4.Text), SqlDbType.Decimal));

        if (ConnectSql_mb.ExecuteNonQuery(sql, list).status)
        {
            string re = HttpContext.Current.User.Identity.Name + "," + txt_tripId.Text + "," + btn_DriverCode.Text;
            if (!btn_DriverCode.Text.Equals(Driver_old))
            {
                re += "," + Driver_old;
            }
            e.Result = re;
        }
        else
        {
            e.Result = "Save Error";
        }
    }
Пример #17
0
 protected void grid_Transport_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
 {
     if (e.Parameters == "OK")
     {
         int    update_error_rowcount = 0;
         string user = HttpContext.Current.User.Identity.Name;
         for (int i = 0; i < list.Count; i++)
         {
             try
             {
                 Record r = list[i];
                 List <ConnectSql_mb.cmdParameters> par_list = new List <ConnectSql_mb.cmdParameters>();
                 par_list.Add(new ConnectSql_mb.cmdParameters("@Id", r.Id, SqlDbType.Int));
                 par_list.Add(new ConnectSql_mb.cmdParameters("@DriverCode", r.driver, SqlDbType.NVarChar, 100));
                 par_list.Add(new ConnectSql_mb.cmdParameters("@TptDate", r.TptDate, SqlDbType.NVarChar, 10));
                 par_list.Add(new ConnectSql_mb.cmdParameters("@TptTime", r.TptTime, SqlDbType.NVarChar, 10));
                 par_list.Add(new ConnectSql_mb.cmdParameters("@Statuscode", r.progress_new, SqlDbType.NVarChar, 10));
                 string sql_where = "";
                 if (r.progress_new == "P" || r.progress_new == "S")
                 {
                     sql_where = ",FromDate=@TptDate,FromTime=@TptTime";
                 }
                 if (r.progress_new == "C")
                 {
                     sql_where = ",ToDate=@TptDate,ToTime=@TptTime";
                 }
                 string sql = string.Format(@"update CTM_JobDet2 set DriverCode=@DriverCode,Statuscode=@Statuscode{0} where Id=@Id", sql_where);
                 // string.Format(@"update tpt_job set Driver='{1}',VehicleNo='{2}' where Id='{0}'", id, driver, progress);
                 //if (r.progress.Length == 0 && r.driver.Length > 0 && r.progress_new.Length == 0)
                 //{
                 //    sql = string.Format(@"update tpt_job set Driver='{1}',JobProgress='Confirmed',DeliveryIndex='{2}',TptTime='{3}',TptDate='{4}' where Id='{0}'", r.Id, r.driver, r.index, r.TptTime, r.TptDate);
                 //}
                 //else
                 //{
                 //    sql = string.Format(@"update tpt_job set Driver='{1}',DeliveryIndex='{2}',TptTime='{3}',JobProgress='{4}',TptDate='{5}' where Id='{0}'", r.Id, r.driver, r.index, r.TptTime, r.progress_new, r.TptDate);
                 //}
                 ConnectSql_mb.ExecuteNonQuery(sql, par_list);
                 C2.CtmJobDet2.tripStatusChanged(SafeValue.SafeInt(r.Id, 0));
                 C2.CtmJobEventLog lg = new C2.CtmJobEventLog();
                 lg.Platform_isWeb();
                 lg.Controller = user;
                 lg.setActionLevel(SafeValue.SafeInt(r.Id, 0), CtmJobEventLogRemark.Level.Trip, 4, ":" + r.progress_new);
                 lg.log();
             }
             catch
             {
                 update_error_rowcount++;
             }
         }
         if (update_error_rowcount > 0)
         {
             e.Result = update_error_rowcount + " Rows Save Error";
         }
         else
         {
             btn_Search_Click(null, null);
         }
     }
 }
Пример #18
0
    private void Job_New_Save(DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
    {
        DateTime date  = DateTime.Now;
        string   time4 = date.ToString("HHmm");

        string jobType   = SafeValue.SafeString(cbb_new_jobtype.Value, "IMP");
        string jobStatus = SafeValue.SafeString(cbb_new_jobstatus.Text, "Quoted");

        string jobType1 = jobType;

        string jobno       = "";
        string user        = HttpContext.Current.User.Identity.Name;
        string quoteNo     = "";
        string billingType = "None";

        if (jobType1 == "TPT")
        {
            billingType = "Job";
        }
        if (jobStatus == "Quoted")
        {
            quoteNo = C2Setup.GetNextNo("", "CTM_Job_" + jobStatus, date);
        }
        else
        {
            jobno   = C2Setup.GetNextNo("", "CTM_Job_" + jobType1, date);
            quoteNo = jobno;
        }
        string wh    = System.Configuration.ConfigurationManager.AppSettings["Warehosue"];
        string sql   = string.Format(@"insert into CTM_Job (JobNo,JobDate,EtaDate,EtdDate,CodDate,StatusCode,CreateBy,CreateDatetime,UpdateBy,UpdateDatetime,EtaTime,EtdTime,JobType,ClientId,YardRef,PickupFrom,DeliveryTo,Remark,WarehouseAddress,JobStatus,QuoteNo,QuoteStatus,QuoteDate,WareHouseCode,BillingType) values ('{0}','{4}',getdate(),getdate(),getdate(),'USE','{1}',getdate(),'{1}',getdate(),'{2}','{2}','{3}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','Pending',getdate(),'{13}','{14}') select @@identity", jobno, user, time4, cbb_new_jobtype.Value, txt_new_JobDate.Date, btn_new_ClientId.Text, "", txt_FromAddress.Text, txt_ToAddress.Text, txt_new_remark.Text, "", jobStatus, quoteNo, wh, billingType);
        int    jobId = SafeValue.SafeInt(ConnectSql_mb.ExecuteScalar(sql), 0);

        if (jobId > 0)
        {
            string            userId = HttpContext.Current.User.Identity.Name;
            C2.CtmJobEventLog elog   = new C2.CtmJobEventLog();
            elog.Platform_isWeb();
            elog.Controller = userId;
            if (jobStatus == "Quoted")
            {
                elog.setActionLevel(jobId, CtmJobEventLogRemark.Level.Quotation, 1);
                elog.ActionLevel_isQuoted(jobId);
                C2Setup.SetNextNo("", "CTM_Job_" + jobStatus, quoteNo, date);
                //GetJobRate(quoteNo, btn_new_ClientId.Text, SafeValue.SafeString(cbb_new_jobtype.Value));
                e.Result = quoteNo;
            }
            else
            {
                elog.setActionLevel(jobId, CtmJobEventLogRemark.Level.Job, 1);
                elog.ActionLevel_isJOB(jobId);
                C2Setup.SetNextNo("", "CTM_Job_" + jobType1, jobno, date);
                e.Result = jobno;
            }
            elog.log();
        }
    }
Пример #19
0
 protected void grid_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
 {
     int index = SafeValue.SafeInt(e.Parameters, -1);
     //string partyId = SafeValue.SafeString((this.grid.GetDataRow(index))["PartyId"]);
     //if (partyId.Length > 0)
     //{
     //    string sql = string.Format("update xxparty set Status=(case when Status='USE' then 'InActive' when Status='InActive' then 'USE' else Status end) where PartyId='{0}'", partyId);
     //    ConnectSql.ExecuteSql(sql);
     //}
 }
Пример #20
0
    private void contCfsStatusChange(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e, int rowIndex, string CfsStatus)
    {
        if (rowIndex < 0)
        {
            e.Result = "Save Error";
            return;
        }

        ASPxLabel lb_id      = this.grid_Transport.FindRowCellTemplateControl(rowIndex, null, "lb_Id") as ASPxLabel;
        ASPxLabel lbl_JobNo  = this.grid_Transport.FindRowCellTemplateControl(rowIndex, null, "lbl_JobNo") as ASPxLabel;
        string    res        = "Save Error";
        string    StatusCode = "";

        if (lb_id != null)
        {
            string sql0 = "";
            if (CfsStatus == "Started")
            {
                sql0 = ",ScheduleStartDate=getdate(),ScheduleStartTime=convert(nvarchar(5),getdate(),114),StatusCode=@StatusCode";
                if (lbl_JobNo.Text.IndexOf("I") >= 0)
                {
                    StatusCode = "WHS-LD";
                }
                if (lbl_JobNo.Text.IndexOf("E") >= 0)
                {
                    StatusCode = "WHS-MT";
                }
            }
            if (CfsStatus == "Completed")
            {
                sql0 = ",CompletionDate=getdate(),CompletionTime=convert(nvarchar(5),getdate(),114),StatusCode=@StatusCode";
                if (lbl_JobNo.Text.IndexOf("I") >= 0)
                {
                    StatusCode = "WHS-MT";
                }
                if (lbl_JobNo.Text.IndexOf("E") >= 0)
                {
                    StatusCode = "WHS-LD";
                }
            }
            string sql = string.Format(@"update CTM_JobDet1 set CfsStatus=@ContStatus{0} 
where Id=@Oid", sql0);
            List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>();
            list.Add(new ConnectSql_mb.cmdParameters("@Oid", lb_id.Text, SqlDbType.Int));
            list.Add(new ConnectSql_mb.cmdParameters("@ContStatus", CfsStatus, SqlDbType.NVarChar, 100));
            list.Add(new ConnectSql_mb.cmdParameters("@StatusCode", StatusCode, SqlDbType.NVarChar, 100));
            if (ConnectSql_mb.ExecuteNonQuery(sql, list).status)
            {
                res = "Save successful!";
                //C2.CtmJobDet1.contWarehouseStatusChanged(SafeValue.SafeInt(lb_id.Text, 0));
            }
        }
        e.Result = res;
    }
Пример #21
0
        protected void ASPxGridView1_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
        {
            int    rowIndex      = int.Parse(e.Parameters);
            string itemCode      = ASPxGridView1.GetRowValues(rowIndex, "ITEM_CODE") as string;
            string itemQTY       = ASPxGridView1.GetRowValues(rowIndex, "ITEM_QTY").ToString();
            string resourceStore = ASPxGridView1.GetRowValues(rowIndex, "STORE_CODE") as string;

            string result = itemCode + "," + itemQTY + "," + resourceStore;

            e.Result = result;
        }
    protected void grid_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
    {
        string paras = e.Parameters;

        if (paras == "Assign")
        {
            ASPxSpinEdit spin_Qty         = grid.FindRowCellTemplateControl(0, null, "spin_Qty") as ASPxSpinEdit;
            ASPxSpinEdit spin_Weight      = grid.FindRowCellTemplateControl(0, null, "spin_Weight") as ASPxSpinEdit;
            ASPxSpinEdit spin_Volume      = grid.FindRowCellTemplateControl(0, null, "spin_Volume") as ASPxSpinEdit;
            ASPxDateEdit date_ShipDate    = grid.FindRowCellTemplateControl(0, null, "date_ShipDate") as ASPxDateEdit;
            ASPxComboBox cbb_ShipIndex    = grid.FindRowCellTemplateControl(0, null, "cbb_ShipIndex") as ASPxComboBox;
            ASPxTextBox  txt_ShipPortCode = grid.FindRowCellTemplateControl(0, null, "txt_ShipPortCode") as ASPxTextBox;
            ASPxComboBox cbb_ContIndex    = grid.FindRowCellTemplateControl(0, null, "cbb_ContIndex") as ASPxComboBox;

            DateTime now   = DateTime.Now;
            string   jobNo = "";
            string   refNo = "";
            Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(C2.JobHouse), "Id=" + lbl_Id.Text + "");
            C2.JobHouse house = C2.Manager.ORManager.GetObject(query) as C2.JobHouse;
            if (house != null)
            {
                #region
                refNo = house.JobNo;
                C2.CtmJob job = new CtmJob();
                jobNo          = C2Setup.GetNextNo("", "CTM_Job_WDO", DateTime.Now);
                job.JobNo      = jobNo;
                job.JobDate    = DateTime.Now;
                job.ClientId   = house.ConsigneeInfo;
                job.DeliveryTo = "";
                C2.Manager.ORManager.StartTracking(job, Wilson.ORMapper.InitialState.Inserted);
                C2.Manager.ORManager.PersistChanges(job);
                C2Setup.SetNextNo("", "CTM_Job_WDO", jobNo, now);

                house.LineId       = SafeValue.SafeInt(lbl_Id.Text, 0);
                job.JobType        = "WDO";
                house.JobNo        = jobNo;
                house.RefNo        = refNo;
                house.CargoType    = "OUT";
                house.CargoStatus  = "P";
                house.QtyOrig      = SafeValue.SafeDecimal(spin_Qty.Value);
                house.WeightOrig   = SafeValue.SafeDecimal(spin_Weight.Value);
                house.VolumeOrig   = SafeValue.SafeDecimal(spin_Volume.Value);
                house.ShipDate     = date_ShipDate.Date;
                house.ShipIndex    = SafeValue.SafeInt(cbb_ShipIndex.Value, 0);
                house.ShipPortCode = txt_ShipPortCode.Text;
                house.ContIndex    = SafeValue.SafeString(cbb_ContIndex.Value);
                C2.Manager.ORManager.StartTracking(house, Wilson.ORMapper.InitialState.Inserted);
                C2.Manager.ORManager.PersistChanges(house);

                #endregion
            }
            e.Result = "Action Success! No is " + jobNo;
        }
    }
Пример #23
0
    protected void ASPxGridView1_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
    {
        string s = e.Parameters;

        if (s == "Save")
        {
            C2.bill_doc  inv           = new C2.bill_doc();
            ASPxComboBox txtCustomerId = ASPxPopupControl1.FindControl("cmb_Customer") as ASPxComboBox;
            ASPxDateEdit txtDocDt      = ASPxPopupControl1.FindControl("txt_DocDt") as ASPxDateEdit;
            ASPxComboBox txtTermId     = ASPxPopupControl1.FindControl("txt_TermId") as ASPxComboBox;

            string counterType = "AR-SIN";

            inv.DocType = "SIN";
            inv.DocDate = txtDocDt.Date;
            string invN = C2Setup.GetNextNo(inv.DocType, counterType, inv.DocDate);
            inv.DocNo   = invN;
            inv.PartyTo = SafeValue.SafeString(txtCustomerId.Value, "");
            string[] currentPeriod = EzshipHelper.GetAccPeriod(txtDocDt.Date);

            inv.AcYear   = SafeValue.SafeInt(currentPeriod[1], txtDocDt.Date.Year);
            inv.AcPeriod = SafeValue.SafeInt(currentPeriod[0], txtDocDt.Date.Month);
            inv.Term     = txtTermId.Text;
            //
            int dueDay = SafeValue.SafeInt(txtTermId.Text.ToUpper().Replace("DAYS", "").Trim(), 0);
            inv.DocDueDate = inv.DocDate.AddDays(dueDay);//SafeValue.SafeDate(dueDt.Text, DateTime.Now);

            inv.AcCode   = EzshipHelper.GetAccArCode(inv.PartyTo, inv.CurrencyId);;
            inv.AcSource = "DB";

            inv.MastRefNo  = "0";
            inv.JobRefNo   = "0";
            inv.MastType   = "";
            inv.ExportInd  = "N";
            inv.UserId     = HttpContext.Current.User.Identity.Name;
            inv.EntryDate  = DateTime.Now;
            inv.CancelDate = new DateTime(1900, 1, 1);
            inv.CancelInd  = "N";
            try
            {
                C2.Manager.ORManager.StartTracking(inv, Wilson.ORMapper.InitialState.Inserted);
                C2.Manager.ORManager.PersistChanges(inv);
                C2Setup.SetNextNo("", counterType, invN, inv.DocDate);
            }
            catch
            {
            }
            e.Result = invN;
            //ClientScriptManager cs = Page.ClientScript;
            //cs.RegisterStartupScript(this.GetType(), "", "<script type=\"text/javascript\">txt_Remark.SetText();cmb_PackType.SetText();spin_Pkgs.SetText();spin_Volume.SetText();spin_Weight.SetText();cmb_Carrier.SetText();cmb_Customer.SetText();cbx_jobCate.SetText();ASPxPopupClientControl.Hide();parent.navTab.openTab(\"" + order.JobNo + "\",\"/Z/job_edit.aspx?id=" + order.SequenceId + "\"" + ",{title:\"" + order.JobNo + "\", fresh:false, external:true});</script>");
        }
    }
Пример #24
0
    protected void grid_Transport_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
    {
        string pars = e.Parameters;

        string[] ar = pars.Split('_');
        if (ar.Length >= 2)
        {
            if (ar[0].Equals("UpdateInline"))
            {
                Update_Inline(e, SafeValue.SafeInt(ar[1], -1));
            }
        }
    }
Пример #25
0
    protected void grid_Transport_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
    {
        string temp = e.Parameters;

        string[] ar = temp.Split('_');
        if (ar.Length == 3)
        {
            if (ar[0] == "UpdateInlineStatus")
            {
                contCfsStatusChange(sender, e, SafeValue.SafeInt(ar[1], -1), ar[2]);
            }
        }
    }
Пример #26
0
    private void ContainerChangeStatus(DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e, int rowIndex)
    {
        if (rowIndex < 0)
        {
            e.Result = "Save Error";
            return;
        }
        TextBox txt_contId = this.grid_Transport.FindRowCellTemplateControl(rowIndex, (DevExpress.Web.ASPxGridView.GridViewDataColumn) this.grid_Transport.Columns["tripDetail"], "txt_contId") as TextBox;
        string  sql        = string.Format(@"update ctm_jobdet1 set StatusCode=(case when StatusCode='Completed' then 'InTransit' else 'Completed' end) where Id={0}
select StatusCode from ctm_jobdet1 where Id={0}", SafeValue.SafeInt(txt_contId.Text, 0));
        string  re         = SafeValue.SafeString(ConnectSql.ExecuteScalar(sql));

        e.Result = "success:" + re + "&,&" + ShowColor(re);
    }
Пример #27
0
    protected void ASPxGridView1_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
    {
        string s = e.Parameters;

        if (s == "Save")
        {
            C2.rate_doc  inv           = new C2.rate_doc();
            ASPxComboBox txtCustomerId = ASPxPopupControl1.FindControl("cmb_Customer") as ASPxComboBox;
            ASPxDateEdit txtDocDt      = ASPxPopupControl1.FindControl("txt_DocDt") as ASPxDateEdit;
            ASPxComboBox txtTermId     = ASPxPopupControl1.FindControl("txt_TermId") as ASPxComboBox;

            string counterType = "AR-SQU";

            inv.DocType = "SQU";
            inv.DocDate = txtDocDt.Date;
            string invN = C2Setup.GetNextNo(inv.DocType, counterType, inv.DocDate);
            inv.DocNo   = invN;
            inv.PartyTo = SafeValue.SafeString(txtCustomerId.Value, "");
            string[] currentPeriod = EzshipHelper.GetAccPeriod(txtDocDt.Date);

            inv.AcYear   = SafeValue.SafeInt(currentPeriod[1], txtDocDt.Date.Year);
            inv.AcPeriod = SafeValue.SafeInt(currentPeriod[0], txtDocDt.Date.Month);
            inv.Term     = txtTermId.Text;
            //
            int dueDay = SafeValue.SafeInt(txtTermId.Text.ToUpper().Replace("DAYS", "").Trim(), 0);
            inv.DocDueDate = inv.DocDate.AddDays(dueDay);//SafeValue.SafeDate(dueDt.Text, DateTime.Now);

            inv.AcCode   = EzshipHelper.GetAccArCode(inv.PartyTo, inv.CurrencyId);;
            inv.AcSource = "DB";

            inv.MastRefNo  = "0";
            inv.JobRefNo   = "0";
            inv.MastType   = "";
            inv.ExportInd  = "N";
            inv.UserId     = HttpContext.Current.User.Identity.Name;
            inv.EntryDate  = DateTime.Now;
            inv.CancelDate = new DateTime(1900, 1, 1);
            inv.CancelInd  = "N";
            try
            {
                C2.Manager.ORManager.StartTracking(inv, Wilson.ORMapper.InitialState.Inserted);
                C2.Manager.ORManager.PersistChanges(inv);
                C2Setup.SetNextNo("", counterType, invN, inv.DocDate);
            }
            catch
            {
            }
            e.Result = invN;
        }
    }
Пример #28
0
    private bool add_newTrip_CheckMultiple(DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e, string Type, string jobNo, string contId)
    {
        bool      res = false;
        string    sql = string.Format(@"select Id,TripCode from ctm_jobdet2 where JobNo='{0}' and Det1Id={1} and TripCode='{2}' order by Id desc", jobNo, contId, Type);
        DataTable dt  = ConnectSql.GetTab(sql);

        if (dt.Rows.Count > 0)
        {
            //throw new Exception("Exist trip:" + Type);
            e.Result = "Save Error:Exist trip " + Type;
            res      = true;
        }
        return(res);
    }
Пример #29
0
    private void Update_Inline(DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e, int rowIndex)
    {
        if (rowIndex < 0)
        {
            e.Result = "Save Error";
            return;
        }
        TextBox        txt_tripId     = this.grid_Transport.FindRowCellTemplateControl(rowIndex, (DevExpress.Web.ASPxGridView.GridViewDataColumn) this.grid_Transport.Columns["tripDetail"], "txt_tripId") as TextBox;
        ASPxButtonEdit btn_Driver     = this.grid_Transport.FindRowCellTemplateControl(rowIndex, (DevExpress.Web.ASPxGridView.GridViewDataColumn) this.grid_Transport.Columns["tripDetail"], "btn_Driver") as ASPxButtonEdit;
        ASPxButtonEdit txt_trailer    = this.grid_Transport.FindRowCellTemplateControl(rowIndex, (DevExpress.Web.ASPxGridView.GridViewDataColumn) this.grid_Transport.Columns["tripDetail"], "txt_trailer") as ASPxButtonEdit;
        ASPxButtonEdit txt_parkingLot = this.grid_Transport.FindRowCellTemplateControl(rowIndex, (DevExpress.Web.ASPxGridView.GridViewDataColumn) this.grid_Transport.Columns["tripDetail"], "txt_parkingLot") as ASPxButtonEdit;
        ASPxMemo       txt_toAddress  = this.grid_Transport.FindRowCellTemplateControl(rowIndex, (DevExpress.Web.ASPxGridView.GridViewDataColumn) this.grid_Transport.Columns["tripDetail"], "txt_toAddress") as ASPxMemo;


        string sql = string.Format(@"select DriverCode from ctm_jobdet2 where Id=@Id");
        List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>();

        list.Add(new ConnectSql_mb.cmdParameters("@Id", txt_tripId.Text, SqlDbType.Int));
        string Driver_old = ConnectSql_mb.ExecuteScalar(sql, list).context;
        string re         = HttpContext.Current.User.Identity.Name + "," + txt_tripId.Text + "," + btn_Driver.Text;

        if (!btn_Driver.Text.Equals(Driver_old))
        {
            re += "," + Driver_old;
        }

        sql  = string.Format(@"update ctm_jobdet2 set 
ToParkingLot=@ToParkingLot,ToCode=@ToCode,DriverCode=@DriverCode,ChessisCode=@ChessisCode
where Id=@Id");
        list = new List <ConnectSql_mb.cmdParameters>();
        list.Add(new ConnectSql_mb.cmdParameters("@Id", txt_tripId.Text, SqlDbType.Int));
        list.Add(new ConnectSql_mb.cmdParameters("@ToParkingLot", txt_parkingLot.Text, SqlDbType.NVarChar, 100));
        list.Add(new ConnectSql_mb.cmdParameters("@ToCode", txt_toAddress.Text, SqlDbType.NVarChar, 300));
        list.Add(new ConnectSql_mb.cmdParameters("@DriverCode", btn_Driver.Text, SqlDbType.NVarChar, 100));
        list.Add(new ConnectSql_mb.cmdParameters("@ChessisCode", txt_trailer.Text, SqlDbType.NVarChar, 100));

        ConnectSql_mb.sqlResult res = ConnectSql_mb.ExecuteNonQuery(sql, list);
        if (res.status)
        {
            e.Result = "success:" + re;
        }
        else
        {
            e.Result = "Save Error:" + res.context;
        }

        //e.Result = txt_tripId.Text;
    }
Пример #30
0
    private void Job_New_Save(DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e)
    {
        DateTime date  = DateTime.Now;
        string   time4 = date.ToString("HHmm");

        string jobType   = SafeValue.SafeString(cbb_new_jobtype.Value, "IMP");
        string jobStatus = SafeValue.SafeString(cbb_new_jobstatus.Text, "Quoted");

        string jobType1 = jobType;

        string jobno       = "";
        string user        = HttpContext.Current.User.Identity.Name;
        string quoteNo     = "";
        string billingType = "None";

        if (jobType1 == "TP")
        {
            billingType = "Job";
        }
        if (jobStatus == "Quoted")
        {
            quoteNo = C2Setup.GetNextNo("", "CTM_Job_" + jobStatus, txt_new_JobDate.Date);
        }
        else
        {
            jobno   = C2Setup.GetNextNo("", "CTM_Job_" + jobType1, txt_new_JobDate.Date);
            quoteNo = jobno;
        }
        string wh  = System.Configuration.ConfigurationManager.AppSettings["Warehosue"];
        string sql = string.Format(@"insert into CTM_Job (JobNo,JobDate,EtaDate,EtdDate,CodDate,StatusCode,CreateBy,CreateDatetime,UpdateBy,UpdateDatetime,EtaTime,EtdTime,JobType,ClientId,YardRef,PickupFrom,DeliveryTo,Remark,WarehouseAddress,JobStatus,QuoteNo,QuoteStatus,QuoteDate,WareHouseCode,BillingType) values ('{0}','{4}',getdate(),getdate(),getdate(),'USE','{1}',getdate(),'{1}',getdate(),'{2}','{2}','{3}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','Pending',getdate(),'{13}','{14}')", jobno, user, time4, cbb_new_jobtype.Value, txt_new_JobDate.Date, btn_new_ClientId.Text, "", txt_FromAddress.Text, txt_ToAddress.Text, txt_new_remark.Text, "", jobStatus, quoteNo, wh, billingType);
        int    i   = ConnectSql_mb.ExecuteNonQuery(sql);

        if (i == 1)
        {
            if (jobStatus == "Quoted")
            {
                C2Setup.SetNextNo("", "CTM_Job_" + jobStatus, quoteNo, txt_new_JobDate.Date);
                //GetJobRate(quoteNo, btn_new_ClientId.Text, SafeValue.SafeString(cbb_new_jobtype.Value));
                e.Result = quoteNo;
            }
            else
            {
                C2Setup.SetNextNo("", "CTM_Job_" + jobType1, jobno, txt_new_JobDate.Date);
                e.Result = jobno;
            }
        }
    }