コード例 #1
0
 protected void gvDiaDiemThi_CustomDataCallback(object sender, ASPxGridViewCustomDataCallbackEventArgs e)
 {
     string strReturn = string.Empty;
     string strMess = string.Empty;
     int iRow = gvDiaDiemThi.VisibleRowCount;
     List<object> keyValues = gvDiaDiemThi.GetSelectedFieldValues("MaDiemThi");
     foreach (object key in keyValues)
     {
         dthiDTO.MaDiemThi = key.ToString();
         int iReturn = dthiDAL.Delete(dthiDTO);
         if (iReturn < 0)
             strMess += " " + key.ToString();
     }
     if (strMess != string.Empty)
         e.Result = "Do ràng buộc dữ liệu, không thể xóa " + strMess;
     else
         e.Result = string.Empty;
     gvDiaDiemThi.DataSource = loadDataToUI();
     gvDiaDiemThi.Selection.SelectAll();
 }
コード例 #2
0
 protected void gvCauHoiLoaiBang_CustomDataCallback(object sender, ASPxGridViewCustomDataCallbackEventArgs e)
 {
     string strReturn = string.Empty;
     string strMess = string.Empty;
     int iRow = gvCauHoiLoaiBang.VisibleRowCount;
     List<object> keyValues = gvCauHoiLoaiBang.GetSelectedFieldValues("STT");
     foreach (object key in keyValues)
     {
         choilbangDTO.STT = key.ToString();
         int iReturn = choilbangDAL.Delete(choilbangDTO);
         if (iReturn < 0)
             strMess += " " + key.ToString();
     }
     if (strMess != string.Empty)
         e.Result = "Do ràng buộc dữ liệu, không thể xóa " + strMess;
     else
         e.Result = string.Empty;
     gvCauHoiLoaiBang.DataSource = loadDataToUI();
     gvCauHoiLoaiBang.Selection.SelectAll();
 }
コード例 #3
0
 protected void gvThiSinh_CustomDataCallback(object sender, ASPxGridViewCustomDataCallbackEventArgs e)
 {
     thisinhDTO = new clsThiSinh_DTO();
     string strReturn = string.Empty;
     string strMess = string.Empty;
     int iRow = gvThiSinh.VisibleRowCount;
     List<object> keyValues = gvThiSinh.GetSelectedFieldValues("MaTS");
     foreach (object key in keyValues)
     {
         thisinhDTO.MaTS = key.ToString();
         int iReturn = thisinhDAL.Delete(thisinhDTO);
         if (iReturn < 0)
             strMess += " " + key.ToString();
     }
     if (strMess != string.Empty)
         e.Result = "Do ràng buộc dữ liệu, không thể xóa " + strMess;
     else
         e.Result = string.Empty;
     gvThiSinh.DataSource = loadDataToUI(thisinhDTO);
     gvThiSinh.Selection.SelectAll();
 }
コード例 #4
0
    protected void gvNguoiDung_CustomDataCallback(object sender, ASPxGridViewCustomDataCallbackEventArgs e)
    {
        ndungDTO = new clsNguoiDung_DTO();

        string strReturn = string.Empty;
        string strMess = string.Empty;
        int iRow = gvNguoiDung.VisibleRowCount;
        List<object> keyValues = gvNguoiDung.GetSelectedFieldValues("TenDangNhap");
        foreach (object key in keyValues)
        {
            ndungDTO.TenDangNhap = key.ToString();
            int iReturn = ndungDAL.Delete(ndungDTO);
            if (iReturn < 0)
                strMess += " " + key.ToString();
        }
        if (strMess != string.Empty)
            e.Result = "Do ràng buộc dữ liệu, không thể xóa " + strMess;
        else
            e.Result = string.Empty;
        gvNguoiDung.DataSource = loadDataToUI();
        gvNguoiDung.Selection.SelectAll();
    }
コード例 #5
0
    protected void grid_CustomDataCallback(object sender, ASPxGridViewCustomDataCallbackEventArgs e)
    {
        string par = e.Parameters;

        string[] ar = par.Split('_');
        if (par == "OK")
        {
            #region Create Inv
            if (Request.QueryString["no"] != null)
            {
                try
                {
                    bool   action = true;
                    string res    = "";
                    string no     = SafeValue.SafeString(Request.QueryString["no"]);
                    string type   = SafeValue.SafeString(Request.QueryString["type"]);
                    if (action)
                    {
                        #region Create Inv
                        string docId = "";
                        if (list.Count > 0)
                        {
                            string   jobNo    = SafeValue.SafeString(Request.QueryString["no"]);
                            string   client   = SafeValue.SafeString(Request.QueryString["client"]);
                            string   contType = SafeValue.SafeString(Request.QueryString["contType"]);
                            string   user     = HttpContext.Current.User.Identity.Name;
                            string   acCode   = EzshipHelper.GetAccArCode("", "SGD");
                            DateTime dtime    = txt_DocDt.Date;
                            string   invN     = C2Setup.GetNextNo("", "AR-IV", dtime);
                            string   termId   = EzshipHelper.GetTerm(client);
                            string   term     = EzshipHelper.GetTermCode(termId);
                            string   currency = cmb_CurrencyId.Text;
                            decimal  exrate   = SafeValue.SafeDecimal(spin_ExRate.Value);
                            string   sql_att  = string.Format(@"select ClientContact from ctm_job where JobNo='{0}'", jobNo);
                            string   contact  = SafeValue.SafeString(ConnectSql.ExecuteScalar(sql_att));
                            string   sql      = string.Format(@"insert into XAArInvoice (DocType,DocDate,PartyTo,DocNo,AcYear,AcPeriod,Term,DocDueDate,Description,
CurrencyId,MastType,ExRate,ExportInd,CancelDate,CancelInd,UserId,EntryDate,Eta,AcCode,AcSource,MastRefNo,Contact)
values('IV','{5:yyyy-MM-dd}','{4}','{0}','{6}','{7}','{8}','{5:yyyy-MM-dd}','',
'{9}','STORAGE',{10},'N','19000101','N','{1}',getdate(),'17530101','{2}','DB','{3}','{11}')
select @@IDENTITY", invN, user, acCode, jobNo, client, dtime, dtime.Year, dtime.Month, term, currency, exrate, contact);
                            docId = ConnectSql_mb.ExecuteScalar(sql);
                            C2Setup.SetNextNo("", "AR-IV", invN, dtime);
                            string code = "";
                            for (int i = 0; i < list.Count; i++)
                            {
                                int    id         = list[i].id;
                                string chgCode    = list[i].chgCode;
                                string chgcodeDes = list[i].chgCodedes;
                                if (IsCostCreated(id))
                                {
                                    C2.ComMethod.CreateInv(invN, id, docId, i, "", currency, exrate);
                                }
                                else
                                {
                                    if (list.Count - i > 1)
                                    {
                                        code += chgcodeDes + " / ";
                                    }
                                    else
                                    {
                                        code += chgcodeDes;
                                    }
                                }
                            }
                            C2.XAArInvoice.update_invoice_mast(SafeValue.SafeInt(docId, 0));
                            if (code.Length == 0)
                            {
                                e.Result = invN;
                            }
                            else
                            {
                                e.Result = "Action Error!" + code + " already exist !";
                            }
                        }
                        else
                        {
                            e.Result = "Action Error!Please keyin select cost ";
                        }
                        #endregion

                        string            userId = HttpContext.Current.User.Identity.Name;
                        C2.CtmJobEventLog elog   = new C2.CtmJobEventLog();
                        elog.Platform_isWeb();
                        elog.Controller = userId;
                        elog.ActionLevel_isINVOICE(SafeValue.SafeInt(docId, 0));
                        elog.setActionLevel(SafeValue.SafeInt(docId, 0), CtmJobEventLogRemark.Level.Invoice, 3);
                        elog.log();
                    }
                    else
                    {
                        e.Result = res;
                    }
                }
                catch { }
            }
            #endregion
        }
        if (par == "Save")
        {
            #region Save All
            if (list.Count > 0)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    int     id        = list[i].id;
                    string  contNo    = list[i].contNo;
                    string  contType  = list[i].contType;
                    decimal price     = list[i].price;
                    decimal qty       = list[i].qty;
                    string  unit      = list[i].unit;
                    string  code      = list[i].chgCode;
                    string  des       = list[i].chgCodedes;
                    int     lineIndex = list[i].lineIndex;
                    string  remark    = list[i].remark;
                    string  groupBy   = list[i].groupBy;
                    decimal locAmt    = SafeValue.ChinaRound(qty * SafeValue.SafeDecimal(price, 0), 2);
                    string  sql       = string.Format(@"update job_cost set ContNo='{0}',ContType='{1}',Price={2},Qty={3},LocAmt={4},Unit='{6}',ChgCode='{7}',ChgCodeDes='{8}',LineIndex={9},Remark='{10}',GroupBy='{11}' where Id={5}",
                                                      contNo, contType, price, qty, locAmt, id, unit, code, des, lineIndex, remark, groupBy);
                    ConnectSql.ExecuteSql(sql);
                }
                e.Result = "Save Success";
            }
            else
            {
                e.Result = "Action Error!Please keyin select cost ";
            }
            #endregion
        }
        if (ar.Length >= 2)
        {
            if (ar[0].Equals("SaveInvline"))
            {
                int rowIndex = SafeValue.SafeInt(ar[1], -1);

                e.Result = Save_Inline(rowIndex, e);
            }
        }
    }