Пример #1
0
        protected void grid_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            ASPxTextBox  txtTLNSDLDong = grid.FindEditFormTemplateControl("txtTLNSDLDong") as ASPxTextBox;
            ASPxTextBox  txtTLNLaoDong = grid.FindEditFormTemplateControl("txtTLNLaoDong") as ASPxTextBox;
            ASPxDateEdit txtThoiDiem   = grid.FindEditFormTemplateControl("txtThoiDiem") as ASPxDateEdit;

            int idLoaiBH = HiddenIdLoaiBH.Count > 0 ? Convert.ToInt32(HiddenIdLoaiBH.Get("idLoaiBH")) : 2;

            this.baohiem.id               = -1;
            this.baohiem.idloaibh         = idLoaiBH;
            this.baohiem.tlnsudunglaodong = txtTLNSDLDong.Text.Trim();
            this.baohiem.tllaodong        = txtTLNLaoDong.Text.Trim();
            this.baohiem.thoidiem         = txtThoiDiem.Date;
            this.objBaoHiem.AddBaoHiem(baohiem);

            grid.CancelEdit();
            e.Cancel             = true;
            this.grid.DataSource = objBaoHiem.GetBaoHiemByIdLoaiBH(idLoaiBH);
            this.grid.DataBind();
        }
Пример #2
0
    protected void grid_InvDet_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
    {
        e.NewValues["QuoteLineNo"] = 1;

        e.NewValues["QuoteId"]   = "-1";
        e.NewValues["FclLclInd"] = "Fcl";
        e.NewValues["ImpExpInd"] = this.txt_type.Text;
        e.NewValues["Price"]     = SafeValue.SafeDecimal(e.NewValues["Price"]);
        if (SafeValue.SafeString(e.NewValues["GstType"], "") == "S")
        {
            e.NewValues["Gst"] = (decimal)0.07;
        }
        else
        {
            e.NewValues["Gst"] = (decimal)0;
        }
        e.NewValues["Pol"]     = SafeValue.SafeString(e.NewValues["Pol"]);
        e.NewValues["Pod"]     = SafeValue.SafeString(e.NewValues["Pod"]);
        e.NewValues["PartyTo"] = SafeValue.SafeString(e.NewValues["PartyTo"]);
    }
Пример #3
0
    protected void grid_Transport_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
    {
        if (SafeValue.SafeString(e.NewValues["VehicleCode"], "") == "")
        {
            throw new Exception("VehicleCode is request");
        }
        e.NewValues["VehicleType"]        = SafeValue.SafeString(e.NewValues["VehicleType"], "");
        e.NewValues["VehicleStatus"]      = SafeValue.SafeString(e.NewValues["VehicleStatus"], "");
        e.NewValues["ContractNo"]         = SafeValue.SafeString(e.NewValues["ContractNo"], "");
        e.NewValues["ContractType"]       = SafeValue.SafeString(e.NewValues["ContractType"], "");
        e.NewValues["ContractDate"]       = SafeValue.SafeDate(e.NewValues["ContractDate"], new DateTime(1753, 1, 1));
        e.NewValues["ContractExpiryDate"] = SafeValue.SafeDate(e.NewValues["ContractExpiryDate"], new DateTime(1753, 1, 1));
        e.NewValues["LicenseNo"]          = SafeValue.SafeString(e.NewValues["LicenseNo"], "");
        e.NewValues["LicenseExpiryDate"]  = SafeValue.SafeDate(e.NewValues["LicenseExpiryDate"], new DateTime(1753, 1, 1));
        e.NewValues["SupplierCode"]       = SafeValue.SafeString(e.NewValues["SupplierCode"], "");
        e.NewValues["Remark"]             = SafeValue.SafeString(e.NewValues["Remark"], "");

        e.NewValues["Date1"] = SafeValue.SafeDate(e.NewValues["Date1"], new DateTime(1990, 1, 1));
        e.NewValues["Date2"] = SafeValue.SafeDate(e.NewValues["Date2"], new DateTime(1990, 1, 1));
    }
Пример #4
0
        protected void grdResource_NodeInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            AppComponent re = new AppComponent(session);

            re.Code                 = e.NewValues["Code"].ToString();
            re.Name                 = e.NewValues["Name"].ToString();
            re.Description          = e.NewValues["Description"].ToString();
            re.RowCreationTimeStamp = DateTime.Now;
            re.RowStatus            = Constant.ROWSTATUS_ACTIVE;

            if (e.NewValues[grdResource.ParentFieldName] != null)
            {
                re.ParentAppComponentId = session.GetObjectByKey <AppComponent>(Guid.Parse(e.NewValues[grdResource.ParentFieldName].ToString()));
            }

            re.Save();

            e.Cancel = true;
            grdResource.CancelEdit();
        }
Пример #5
0
    protected void ASPxGridView1_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
    {
        //新增
        int            indexUser;
        ASPxGridLookup gridLookupUser = ASPxGridView1.FindEditFormTemplateControl("GridLookupUser") as ASPxGridLookup;
        ASPxGridLookup gridLookupTeam = ASPxGridView1.FindEditFormTemplateControl("GridLookupTeam") as ASPxGridLookup;

        List <object> Users = gridLookupUser.GridView.GetSelectedFieldValues("USER_ID");
        string        Teams = gridLookupTeam.Value.ToString();

        for (indexUser = 0; indexUser < Users.Count; indexUser++)
        {
            string inSql = "INSERT INTO REL_TEAM_USER(COMPANY_CODE,PLINE_CODE,TEAM_CODE,USER_ID)"
                           + " VALUES('" + theCompanyCode + "','" + thePlCode + "','" + Teams + "','" + Users[indexUser].ToString() + "')";
            theDc.ExeSql(inSql);
        }
        queryFunction();
        e.Cancel = true;
        ASPxGridView1.CancelEdit();
    }
Пример #6
0
    protected void grid_InvDet_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
    {
        //string where = "QuoteId='-1'";
        //where += " and PartyTo='" + SafeValue.SafeString(e.NewValues["PartyTo"], "") + "'";

        //string sql_detCnt = "select max(QuoteLineNo) from SeaQuoteDet1 where " + where;
        //int lineNo = SafeValue.SafeInt(C2.Manager.ORManager.ExecuteScalar(sql_detCnt), 0) + 1;
        e.NewValues["QuoteLineNo"] = 1;

        e.NewValues["QuoteId"]   = "-1";
        e.NewValues["FclLclInd"] = "";
        e.NewValues["ImpExpInd"] = this.txt_type.Text;
        e.NewValues["PartyType"] = "C";
        e.NewValues["PartyTo"]   = "";
        //if (SafeValue.SafeString(e.NewValues["GstType"], "") == "S")
        //    e.NewValues["Gst"] = (decimal)0.07;
        //else
        //    e.NewValues["Gst"] = (decimal)0;
        //e.NewValues["Amt"] = SafeValue.ChinaRound(SafeValue.SafeDecimal(e.NewValues["Price"], 0) * SafeValue.SafeDecimal(e.NewValues["Qty"], 1)*(1 + SafeValue.SafeDecimal(e.NewValues["Gst"], 0)), 2);
    }
Пример #7
0
    protected void ASPxGridView1_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
    {
        ASPxTextBox uCode = ASPxGridView1.FindEditFormTemplateControl("txtPlineCode") as ASPxTextBox;
        ASPxTextBox uName = ASPxGridView1.FindEditFormTemplateControl("txtPlineName") as ASPxTextBox;

        ASPxComboBox uTcode = ASPxGridView1.FindEditFormTemplateControl("dropPlineType") as ASPxComboBox;
        ASPxTextBox  uScode = ASPxGridView1.FindEditFormTemplateControl("txtSapCode") as ASPxTextBox;
        ASPxComboBox uSflag = ASPxGridView1.FindEditFormTemplateControl("ASPxComboBox2") as ASPxComboBox;
        ASPxComboBox uTflag = ASPxGridView1.FindEditFormTemplateControl("ASPxComboBox1") as ASPxComboBox;


        string Sql = "INSERT INTO CODE_PRODUCT_LINE (RMES_ID,COMPANY_CODE,PLINE_CODE,PLINE_NAME,PLINE_TYPE_CODE,THIRD_FLAG,STOCK_FLAG,SAP_CODE) "
                     + "VALUES(SEQ_RMES_ID.NextVal, '" + theCompanyCode + "','" + uCode.Text.Trim() + "','" + uName.Text.Trim() + "','" + uTcode.Value.ToString() + "','" + uTflag.Value.ToString() + "','" + uSflag.Value.ToString() + "','" + uScode.Value.ToString() + "')";

        dc.ExeSql(Sql);

        e.Cancel = true;
        ASPxGridView1.CancelEdit();
        setCondition();
    }
    protected void gvKetQuaThi_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
    {
        e.Cancel         = true;
        kqtDTO.SoDeThi   = e.NewValues["SoDeThi"].ToString();
        kqtDTO.MaTS      = e.NewValues["MaTS"].ToString();;
        kqtDTO.DiemDanh  = e.NewValues["DiemDanh"].ToString();
        kqtDTO.KetQuaThi = e.NewValues["KetQuaThi"].ToString();
        int iReturn = kqtDAL.InsertUpdate(kqtDTO);

        if (iReturn >= 0)
        {
            gvKetQuaThi.DataSource = loadDataToUI();
            gvKetQuaThi.CancelEdit();
        }
        else
        {
            strMess = "Lưu Dữ Liệu Không Thành Công";
            gvKetQuaThi.DoRowValidation();
        }
    }
Пример #9
0
        protected void gvShifts_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            var newShiftName = Utils.ConvertToTrimmedString(e.NewValues["shift_name"]);

            if (newShiftName == null)
            {
                e.Cancel = true;
                throw new Exception("Complete all fields!");
            }

            string message = SettsUtils.ShiftInsertVerify(newShiftName);

            if (message != null)
            {
                e.Cancel = true;
                throw new Exception(message);
            }

            e.NewValues["shift_name"] = newShiftName;
        }
Пример #10
0
    protected void gvNhomNguoiDung_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
    {
        e.Cancel = true;
        //nhomNDDTO.MaNhom = e.NewValues["MaNhom"].ToString();
        //nhomNDDTO.NgayThanhLap = cmn.Convert_DMY_To_MDY(e.NewValues["NgayThanhLap"].ToString());
        //  nhomNDDTO.SoDienThoai = e.NewValues["SoDienThoai"].ToString();
        nhomNDDTO.TenNhom = e.NewValues["TenNhom"].ToString();
        int iReturn = nhomNDDAL.InsertUpdate(nhomNDDTO);

        if (iReturn >= 0)
        {
            gvNhomNguoiDung.DataSource = loadDataToUI();
            gvNhomNguoiDung.CancelEdit();
        }
        else
        {
            strMess = "Lưu Dữ Liệu Không Thành Công";
            gvNhomNguoiDung.DoRowValidation();
        }
    }
Пример #11
0
    protected void grid_InvDet_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
    {
        ASPxGridView grd        = sender as ASPxGridView;
        string       sql_detCnt = "select max(QuoteLineNo) from SeaQuoteDet1 where QuoteId='" + SafeValue.SafeInt(grd.GetMasterRowKeyValue(), 0) + "'";
        int          lineNo     = SafeValue.SafeInt(Manager.ORManager.ExecuteScalar(sql_detCnt), 0) + 1;

        e.NewValues["QuoteId"]     = SafeValue.SafeString(grd.GetMasterRowKeyValue(), "");
        e.NewValues["QuoteLineNo"] = lineNo;
        e.NewValues["ImpExpInd"]   = this.txt_type.Text;
        e.NewValues["FclLclInd"]   = "Lcl";
        if (SafeValue.SafeString(e.NewValues["GstType"], "") == "S")
        {
            e.NewValues["Gst"] = (decimal)0.07;
        }
        else
        {
            e.NewValues["Gst"] = (decimal)0;
        }
        //e.NewValues["Amt"] = SafeValue.SafeDecimal(e.NewValues["Price"], 0) * SafeValue.SafeDecimal(e.NewValues["Qty"], 1) * (1 + SafeValue.SafeDecimal(e.NewValues["Gst"], 0));
    }
Пример #12
0
        protected void GridTouristSiteView_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            TouristSiteViewModel model = new TouristSiteViewModel();

            model.CountryId   = e.NewValues["CountryId"] == null? 0:(int)e.NewValues["CountryId"];
            model.Description = e.NewValues["Description"].ToString() ?? string.Empty;
            model.PlaceId     = e.NewValues["PlaceId"] == null ? 0 : (int)e.NewValues["PlaceId"];
            model.RegionId    = e.NewValues["RegionId"] == null ? 0 : (int)e.NewValues["RegionId"];
            model.SiteCode    = e.NewValues["SiteCode"].ToString() ?? string.Empty;
            model.SiteName    = e.NewValues["SiteName"].ToString() ?? string.Empty;
            model.Stars       = e.NewValues["Stars"] == null ? 0 : (int)e.NewValues["Stars"];
            //model.ImageGalleryPath = e.NewValues["ImageGalleryPath"].ToString()?? string.Empty;
            //model.ImageThumbnailsPath = e.NewValues["ImageThumbnailsPath"].ToString()?? string.Empty;

            controller.AddTouristSite(model);
            e.Cancel = true;
            GridTouristSiteView.CancelEdit();

            Bind();
        }
Пример #13
0
        protected void gridBarCode_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            data = new dataHangHoa();
            ASPxGridView gridBarCode = sender as ASPxGridView;
            object       IDHangHoa   = gridBarCode.GetMasterRowKeyValue();
            string       BarCode     = e.NewValues["Barcode"].ToString();

            if (dataHangHoa.KiemTraBarcode(BarCode) == true)
            {
                data.ThemBarCode(IDHangHoa, BarCode);
            }
            else
            {
                throw new Exception("Lỗi:Barcode đã tồn tại");
            }
            e.Cancel = true;
            gridBarCode.CancelEdit();
            gridBarCode.DataSource = data.GetListBarCode(IDHangHoa);
            gridBarCode.DataBind();
        }
Пример #14
0
        protected void grdGeneralJournal_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            ASPxGridView grid = sender as ASPxGridView;

            e.NewValues["RowStatus"]         = Utility.Constant.ROWSTATUS_ACTIVE;
            e.NewValues["TransactionId!Key"] = grid.GetMasterRowKeyValue();
            if (AccountingBO.IsApproved(session, Guid.Parse(grid.GetMasterRowKeyValue().ToString())))
            {
                throw new Exception("Hạch toán đã được duyệt. Không thể thêm!!!");
                e.Cancel = true;
            }
            if (e.NewValues["Credit"] == null)
            {
                e.NewValues["Credit"] = (double)0;
            }
            if (e.NewValues["Debit"] == null)
            {
                e.NewValues["Debit"] = (double)0;
            }
        }
Пример #15
0
 protected void grd_DSUsers_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
 {
     try
     {
         e.Cancel = true;
         ASPxFormLayout pnLayData = grd_DSUsers.FindEditFormTemplateControl("LayOutThemSua") as ASPxFormLayout;
         User           user      = new User();
         Utils.setView2ObjectLayout <User>(user, pnLayData);
         user.LockoutEnabled = false;
         user.Password       = Utils.Encrypt(user.Password);
         getFirstLastName(user);
         ctlUser.insertUsers(user);
         Bindata();
         Utils.notifierGrid(grd_DSUsers, Constant.NOTIFY_SUCCESS, "Bạn đã thêm thành công tài khoản [" + user.Id_Login + "]");
     }
     catch (Exception ex)
     {
         Utils.notifierGrid(grd_DSUsers, Constant.NOTIFY_FAILURE, ex.Message + " " + ex.StackTrace);
     }
 }
Пример #16
0
 protected void gridComponentRTMItem_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
 {
     if (Session["ComponentId"] != null)
     {
         ASPxGridView  gridComponentRTMItem = (ASPxGridView)sender;
         ASPxGridView  gridRTMItem          = (ASPxGridView)gridComponentRTMItem.FindEditFormLayoutItemTemplateControl("gridRTMItem");
         List <string> ItemsList            = new List <string>();
         for (int i = 0; i <= gridRTMItem.VisibleRowCount; i = i + 1)
         {
             if (gridRTMItem.Selection.IsRowSelected(i) == true)
             {
                 ItemsList.Add(gridRTMItem.GetRowValues(i, "src_id").ToString());
             }
         }
         rc_services.InsertComponentProjectRTMItem(Session["ComponentId"].ToString(), ItemsList);
         e.Cancel = true;
         gridComponentRTMItem.CancelEdit();
         gridComponentRTMItem.DataBind();
     }
 }
Пример #17
0
    //protected void ASPxGridView1_CustomCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomCallbackEventArgs e)
    //{
    //    setCondition();
    //    ASPxGridView1.Selection.UnselectAll();

    //}

    protected void ASPxGridView1_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
    {
        //调用存储过程进行处理

        MS_MODIFY_OVER_MAT sp = new MS_MODIFY_OVER_MAT()
        {
            FUNC1         = "UPDATE",
            MATERIALCODE1 = e.NewValues["MATERIAL_CODE"].ToString(),
            LINESIDENUM1  = e.NewValues["MATERIAL_NUM"].ToString(),
            GZDD1         = e.NewValues["GZDD"].ToString(),
            YHDM1         = theUserCode,
            QADSITE1      = e.NewValues["QADSITE"].ToString()
        };

        Rmes.DA.Base.Procedure.run(sp);

        setCondition();
        e.Cancel = true;
        ASPxGridView1.CancelEdit();
    }
        protected void gridNhaCungCap_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            data = new dtNhaCungCap();
            string tenNhaCungCap    = e.NewValues["TenNhaCungCap"].ToString();
            string dienThoai        = e.NewValues["DienThoai"] == null ? "" : e.NewValues["DienThoai"].ToString();
            string fax              = e.NewValues["Fax"] == null ? "" : e.NewValues["Fax"].ToString();
            string email            = e.NewValues["Email"] == null ? "" : e.NewValues["Email"].ToString();
            string diaChi           = e.NewValues["DiaChi"] == null ? "" : e.NewValues["DiaChi"].ToString();
            string nguoiLienHe      = e.NewValues["NguoiLienHe"] == null ? "" : e.NewValues["NguoiLienHe"].ToString();
            string maSoThue         = e.NewValues["MaSoThue"] == null ? "" : e.NewValues["MaSoThue"].ToString();
            string linhVucKinhDoanh = e.NewValues["LinhVucKinhDoanh"] == null ? "" : e.NewValues["LinhVucKinhDoanh"].ToString();
            //string loGo = ""; //e.NewValues["TenNganhHang"].ToString();
            DateTime NgayCapNhat = DateTime.Today.Date;
            string   ghiChu      = e.NewValues["GhiChu"] == null ? "" : e.NewValues["GhiChu"].ToString();

            data.ThemNhaCungCap(tenNhaCungCap, dienThoai, fax, email, diaChi, nguoiLienHe, maSoThue, linhVucKinhDoanh, NgayCapNhat, ghiChu);
            e.Cancel = true;
            gridNhaCungCap.CancelEdit();
            LoadGrid();
        }
Пример #19
0
    protected void ASPxGridView1_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
    {
        string sql = string.Format(@"select count(*) from xxchgcode where ChgcodeId='{0}'", e.NewValues["ChgcodeId"]);
        int    n   = SafeValue.SafeInt(ConnectSql.ExecuteScalar(sql), 0);

        if (n > 0)
        {
            throw new Exception("Pls enter another code,Already exist");
        }
        e.NewValues["Quotation_Ind"]  = SafeValue.SafeString(e.NewValues["Quotation_Ind"]);
        e.NewValues["ChgcodeId"]      = SafeValue.SafeString(e.NewValues["ChgcodeId"]).Replace("'", "");
        e.NewValues["ChgcodeDe"]      = SafeValue.SafeString(e.NewValues["ChgcodeDe"]).Replace("'", "");
        e.NewValues["ChgUnit"]        = SafeValue.SafeString(e.NewValues["ChgUnit"]);
        e.NewValues["GstTypeId"]      = SafeValue.SafeString(e.NewValues["GstTypeId"]);
        e.NewValues["GstP"]           = SafeValue.SafeDecimal(e.NewValues["GstP"]);
        e.NewValues["ArCode"]         = SafeValue.SafeString(e.NewValues["ArCode"]);
        e.NewValues["ApCode"]         = SafeValue.SafeString(e.NewValues["ApCode"]);
        e.NewValues["ChgTypeId"]      = SafeValue.SafeString(e.NewValues["ChgTypeId"]);
        e.NewValues["ArShortcutCode"] = SafeValue.SafeString(e.NewValues["ArShortcutCode"]);
    }
        protected void gvAcreedores_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            try
            {
                SPWeb         app2  = SPContext.Current.Web;
                bool          crear = false;
                LogicaNegocio LN    = new LogicaNegocio();

                crear = LN.Acreedores(3, e.NewValues["Rut"].ToString(), 0, e.NewValues["Nombre"].ToString(), e.NewValues["Domicilio"].ToString(), Convert.ToInt32(e.NewValues["IdTipoAcreedor"]), Convert.ToInt32(e.NewValues["IdRegion"]), Convert.ToInt32(e.NewValues["Idprovincia"]), Convert.ToInt32(e.NewValues["IdComuna"]), util.ObtenerValor(app2.CurrentUser.Name));
            }
            catch (Exception ex)
            {
                LoggingError.PostEventRegister(ex, ConfigurationManager.AppSettings["pathLog"].ToString(), "", "", ConfigurationManager.AppSettings["logName"].ToString(), Convert.ToBoolean(ConfigurationManager.AppSettings["enabledLog"].ToString()), Convert.ToBoolean(ConfigurationManager.AppSettings["enabledEventViewer"].ToString()), ConfigurationManager.AppSettings["registerEventsTypes"].ToString(), EventLogEntryType.Error);
            }

            gvAcreedores.CancelEdit();
            e.Cancel = true;

            CargarAcreedores(txtAcreedor.Text.Trim(), txtRutAcreedor.Text.Trim());
        }
Пример #21
0
        /// <summary>
        /// Check values before insert and after Parse_Value()
        /// http://www.devexpress.com/Support/Center/Question/Details/Q308089
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ASPxGridView1_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            /*
             * if (e.NewValues["UserId"] == null) {
             *  e.NewValues["UserId"] = 0;
             * }
             */

            var UserPass = ASPxGridView1.FindEditFormTemplateControl("UserPass") as ASPxTextBox;

            if (UserPass.Value != null)
            {
                var userId = Session["User.UserId"].ToString();
                e.NewValues["UserPass"] = UserLogin.GetNewUserPassword(userId, UserPass.Value.ToString(), UserLogin.EncryptionHashAlgorithm.SHA512, Global.DAL.GetConnectionStringDBData());
            }
            else
            {
                e.NewValues["UserPass"] = System.Guid.NewGuid().ToString();
            }
        }
Пример #22
0
    protected void gvDiaDiemThi_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
    {
        e.Cancel             = true;
        dthiDTO.MaDiemThi    = e.NewValues["MaDiemThi"].ToString();
        dthiDTO.NgayThanhLap = cmn.Convert_DMY_To_MDY(e.NewValues["NgayThanhLap"].ToString());
        dthiDTO.SoDienThoai  = e.NewValues["SoDienThoai"].ToString();
        dthiDTO.DiaChi       = e.NewValues["DiaChi"].ToString();
        int iReturn = dthiDAL.InsertUpdate(dthiDTO);

        if (iReturn >= 0)
        {
            gvDiaDiemThi.DataSource = loadDataToUI();
            gvDiaDiemThi.CancelEdit();
        }
        else
        {
            strMess = "Lưu Dữ Liệu Không Thành Công";
            gvDiaDiemThi.DoRowValidation();
        }
    }
    protected void gvCauHoiLoaiBang_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
    {
        e.Cancel = true;
        // choilbangDTO.MaLoaiBang = e.NewValues["MaLoaiBang"].ToString();
        choilbangDTO.MaLoaiBang = cboLoaiBang.Value.ToString();
        choilbangDTO.MaCauHoi   = e.NewValues["MaCauHoi"].ToString();
        choilbangDTO.STT        = e.NewValues["STT"].ToString();
        int iReturn = choilbangDAL.InsertUpdate(choilbangDTO);

        if (iReturn >= 0)
        {
            gvCauHoiLoaiBang.DataSource = loadDataToUI();
            gvCauHoiLoaiBang.CancelEdit();
        }
        else
        {
            strMess = "Lưu Dữ Liệu Không Thành Công";
            gvCauHoiLoaiBang.DoRowValidation();
        }
    }
Пример #24
0
        protected void gvRooms_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            dsData = Session[Constants.SESSION_ROOMS] as DataSet;
            ASPxGridView gridView = sender as ASPxGridView;
            DataRow      row      = dsData.Tables[0].NewRow();
            Random       rd       = new Random();

            e.NewValues["RoomId"]      = rd.Next();
            e.NewValues["StatusId"]    = (int)Enums.HBMStatus.Active;
            e.NewValues["CompanyId"]   = SessionHandler.CurrentCompanyId;
            e.NewValues["CreatedUser"] = SessionHandler.LoggedUser.UsersId;

            IDictionaryEnumerator enumerator = e.NewValues.GetEnumerator();

            enumerator.Reset();
            while (enumerator.MoveNext())
            {
                if (enumerator.Key.ToString() != "Count")
                {
                    row[enumerator.Key.ToString()] = enumerator.Value == null ? DBNull.Value : enumerator.Value;
                }
            }
            gridView.CancelEdit();
            e.Cancel = true;

            dsData.Tables[0].Rows.Add(row);

            rooms.RoomCode = e.NewValues["RoomCode"].ToString();

            //if (!rooms.IsDuplicateTypeName())
            //{
            if (rooms.Save(dsData))
            {
                this.LoadRooms();
            }
            //}
            //else
            //{
            //throw new System.Exception(Messages.Duplicate_record);
            //}
        }
Пример #25
0
    //新增
    protected void ASPxGridView1_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
    {
        ASPxComboBox uPCode    = ASPxGridView1.FindEditFormTemplateControl("txtPCode") as ASPxComboBox;
        ASPxTextBox  uSName    = ASPxGridView1.FindEditFormTemplateControl("txtSName") as ASPxTextBox;
        ASPxTextBox  uSinitial = ASPxGridView1.FindEditFormTemplateControl("txtSinitial") as ASPxTextBox;

        ASPxTextBox  uSmax     = ASPxGridView1.FindEditFormTemplateControl("txtSmax") as ASPxTextBox;
        ASPxTextBox  uSwarning = ASPxGridView1.FindEditFormTemplateControl("txtSwarning") as ASPxTextBox;
        ASPxComboBox uIflag    = ASPxGridView1.FindEditFormTemplateControl("ASPxComboBox1") as ASPxComboBox;
        ASPxComboBox uEflag    = ASPxGridView1.FindEditFormTemplateControl("ASPxComboBox2") as ASPxComboBox;

        string strPCode    = uPCode.Value.ToString();
        string strSinitial = uSinitial.Text.Trim();
        string strSName    = uSName.Text.Trim();

        string strSmax     = uSmax.Text.Trim();
        string strSwarning = uSwarning.Text.Trim();

        string strIflag = uIflag.Value.ToString();
        string strEflag = uEflag.Value.ToString();

        char chr = Convert.ToChar(strIflag);

        if (chr == 'A')
        {
            string Sql = "INSERT INTO CODE_SN (RMES_ID,COMPANY_CODE,PLINE_CODE,INITIAL_VALUE,CURRENT_VALUE,MAX_VALUE,INCREASE_FLAG,ENABLE_FLAG,WARNING_VALUE,VENDER_CODE) "
                         + "VALUES(SEQ_RMES_ID.NextVal, '" + theCompanyCode + "','" + strPCode + "','" + strSinitial + "','" + strSinitial + "','" + strSmax + "','" + strIflag + "','" + strEflag + "','" + strSwarning + "','" + strSName + "')";
            dc.ExeSql(Sql);
        }
        else
        {
            string Sql = "INSERT INTO CODE_SN (RMES_ID,COMPANY_CODE,PLINE_CODE,INITIAL_VALUE,CURRENT_VALUE,MAX_VALUE,INCREASE_FLAG,ENABLE_FLAG,WARNING_VALUE,VENDER_CODE) "
                         + "VALUES(SEQ_RMES_ID.NextVal, '" + theCompanyCode + "','" + strPCode + "','" + strSinitial + "','" + strSmax + "','" + strSmax + "','" + strIflag + "','" + strEflag + "','" + strSwarning + "','" + strSName + "')";
            dc.ExeSql(Sql);
        }


        e.Cancel = true;
        ASPxGridView1.CancelEdit();
        setCondition();
    }
Пример #26
0
        protected void grdLeave_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            ASPxTextBox  txtEmpId    = grdLeave.FindEditFormTemplateControl("txtEmpId") as ASPxTextBox;
            ASPxTextBox  txtId       = grdLeave.FindEditFormTemplateControl("txtId") as ASPxTextBox;
            ASPxTextBox  txtReason   = grdLeave.FindEditFormTemplateControl("txtReason") as ASPxTextBox;
            ASPxTextBox  txtYear     = grdLeave.FindEditFormTemplateControl("txtYear") as ASPxTextBox;
            ASPxComboBox ddlType     = grdLeave.FindEditFormTemplateControl("ddlType") as ASPxComboBox;
            ASPxComboBox ddlProvince = grdLeave.FindEditFormTemplateControl("ddlProvince") as ASPxComboBox;
            ASPxDateEdit calToDate   = grdLeave.FindEditFormTemplateControl("calToDate") as ASPxDateEdit;
            ASPxDateEdit calFromDate = grdLeave.FindEditFormTemplateControl("calFromDate") as ASPxDateEdit;

            this.leave.id           = -1;
            this.leave.reason       = txtReason.Text;
            this.leave.year         = Int32.Parse(txtYear.Text);
            this.leave.fromdate     = Convert.ToDateTime(calFromDate.Value.ToString());
            this.leave.todate       = Convert.ToDateTime(calToDate.Value.ToString());
            this.leave.unitid       = objEmployees.GetEmployees(Int32.Parse(Session["Id"].ToString())).unitid;
            this.leave.employeeid   = Int32.Parse(Session["Id"].ToString());
            this.leave.provinceid   = Int32.Parse(ddlProvince.SelectedItem.Value.ToString());
            this.leave.editor       = this.UserId;
            this.leave.modifieddate = DateTime.Now;
            this.leave.ip           = HttpContext.Current.Request.UserHostAddress;

            if (ddlType.SelectedIndex == 0)
            {
                this.leave.leavetype = false;
            }
            else
            {
                this.leave.leavetype = true;
            }


            objLeave.AddLeave(leave);



            grdLeave.CancelEdit();
            e.Cancel = true;
            BindGridLeave(Int32.Parse(Session["Id"].ToString()));
        }
Пример #27
0
        protected void gvJenisKreditKemitraan_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            ActivityLog    log       = new ActivityLog();
            ActivityLogBll logBll    = new ActivityLogBll();
            string         host      = Request.UserHostName;
            string         ipaddress = Request.UserHostAddress;
            string         userName  = Session["user"].ToString();

            if (String.IsNullOrEmpty(ipaddress))
            {
                ipaddress = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
            }
            log.HostName  = host;
            log.IPAddress = ipaddress;
            log.Action    = "Insert";
            log.UserName  = userName;

            try
            {
                Hashtable ht = new Hashtable();
                ht.Add("@CreateBy-varchar-50", Page.User.Identity.Name.ToString());
                ht.Add("@Deskripsi-varchar-20", e.NewValues["descr"].ToString());
                ht.Add("@Status-bit", e.NewValues["is_active"]);

                bll.InsertData(ht);
                log.Type        = "S";
                log.Description = log.Action + ' ' + "sukses oleh id" + ' ' + userName;
                e.Cancel        = true;
                gvJenisKreditKemitraan.CancelEdit();
                GetData();
            }
            catch (Exception ex)
            {
                log.Type        = "E";
                log.Description = "Insert Error : " + ex.Message;
            }
            finally
            {
                logBll.InsertActivity(log);
            }
        }
Пример #28
0
    protected void grid_InvDet_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
    {
        if (SafeValue.SafeString(e.NewValues["AcCode"], "").Length < 1)
        {
            e.Cancel = true;
            throw new Exception("Pls select the charge code");
        }
        ASPxGridView grd        = sender as ASPxGridView;
        string       sql_detCnt = "select count(DocId) from XAArInvoiceDet where DocId='" + SafeValue.SafeInt(grd.GetMasterRowKeyValue(), 0) + "'";
        int          lineNo     = SafeValue.SafeInt(Manager.ORManager.ExecuteScalar(sql_detCnt), 0) + 1;

        //e.NewValues["CostingId"] = "";
        e.NewValues["DocId"]     = SafeValue.SafeInt(grd.GetMasterRowKeyValue(), 0);
        e.NewValues["DocLineNo"] = lineNo;
        ASPxTextBox  docN    = this.ASPxGridView1.FindEditFormTemplateControl("txt_DocNo") as ASPxTextBox;
        ASPxComboBox docType = this.ASPxGridView1.FindEditFormTemplateControl("cbo_DocType") as ASPxComboBox;

        e.NewValues["DocNo"]   = docN.Text;
        e.NewValues["DocType"] = docType.Text;
        if (!e.NewValues["Currency"].Equals("SGD"))
        {
            e.NewValues["GstType"] = "Z";
            e.NewValues["Gst"]     = new decimal(0);
        }
        if (SafeValue.SafeDecimal(e.NewValues["ExRate"], 1) == 0)
        {
            e.NewValues["ExRate"] = 1;
        }
        decimal amt    = SafeValue.ChinaRound(SafeValue.SafeDecimal(e.NewValues["Qty"], 0) * SafeValue.SafeDecimal(e.NewValues["Price"], 0), 2);
        decimal gstAmt = SafeValue.ChinaRound((amt * SafeValue.SafeDecimal(e.NewValues["Gst"], 0)), 2);
        decimal docAmt = amt + gstAmt;
        decimal locAmt = SafeValue.ChinaRound(docAmt * SafeValue.SafeDecimal(e.NewValues["ExRate"], 1), 2);

        e.NewValues["GstAmt"] = gstAmt;
        e.NewValues["DocAmt"] = docAmt;
        e.NewValues["LocAmt"] = locAmt;
        if (SafeValue.SafeString(e.NewValues["JobRefNo"]).Length > 1)
        {
            e.NewValues["SplitType"] = "Set";
        }
    }
Пример #29
0
    protected void grid_det_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
    {
        ASPxPageControl pageControl = this.grid.FindEditFormTemplateControl("pageControl") as ASPxPageControl;
        ASPxTextBox     txt_Id      = pageControl.FindControl("txt_Id") as ASPxTextBox;
        ASPxTextBox     txt_SoNo    = pageControl.FindControl("txt_SoNo") as ASPxTextBox;

        e.NewValues["SoNo"]    = txt_SoNo.Text;
        e.NewValues["LineSNo"] = SafeValue.SafeInt(txt_Id.Text, 0);
        if (SafeValue.SafeString(e.NewValues["Product"], "").Length < 1)
        {
            e.Cancel = true;
            throw new Exception("Pls select the Product");
        }
        if (!e.NewValues["Currency"].Equals("SGD"))
        {
            e.NewValues["GstType"] = "Z";
            e.NewValues["Gst"]     = new decimal(0);
        }
        if (SafeValue.SafeDecimal(e.NewValues["ExRate"], 1) == 0)
        {
            e.NewValues["ExRate"] = 1.0;
        }
        if (e.NewValues["GstType"].Equals("S"))
        {
            e.NewValues["Gst"] = new decimal(0.07);
        }
        decimal amt    = SafeValue.ChinaRound(SafeValue.SafeDecimal(e.NewValues["Qty"], 0) * SafeValue.SafeDecimal(e.NewValues["Price"], 0), 2);
        decimal gstAmt = SafeValue.ChinaRound((amt * SafeValue.SafeDecimal(e.NewValues["Gst"], 0)), 2);
        decimal docAmt = amt + gstAmt;
        decimal locAmt = SafeValue.ChinaRound(docAmt * SafeValue.SafeDecimal(e.NewValues["ExRate"], 1), 2);

        e.NewValues["GstAmt"]         = gstAmt;
        e.NewValues["DocAmt"]         = docAmt;
        e.NewValues["LocAmt"]         = locAmt;
        e.NewValues["CreateBy"]       = HttpContext.Current.User.Identity.Name;
        e.NewValues["CreateDateTime"] = DateTime.Now;
        int qty = SafeValue.SafeInt(e.NewValues["Qty"], 0);

        e.NewValues["Qty"]    = qty;
        e.NewValues["BalQty"] = qty;
    }
Пример #30
0
    protected void grid_Mkgs_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
    {
        ASPxGridView g    = sender as ASPxGridView;
        ASPxTextBox  refN = grid1.FindEditFormTemplateControl("TXT0") as ASPxTextBox;

        e.NewValues["RefNo"] = refN.Text;

        e.NewValues["CreateBy"]       = EzshipHelper.GetUserName();
        e.NewValues["CreateDateTime"] = DateTime.Now;
        e.NewValues["UpdateBy"]       = EzshipHelper.GetUserName();
        e.NewValues["UpdateDateTime"] = DateTime.Now;
        string jobType = EzshipHelper.GetJobType("SE", refN.Text);

        if (jobType == "FCL")
        {
            e.NewValues["MkgType"] = "CONT";
        }
        else
        {
            e.NewValues["MkgType"] = "BL";
        }

        e.NewValues["ContainerType"] = SafeValue.SafeString(e.NewValues["ContainerType"]);
        e.NewValues["PackageType"]   = SafeValue.SafeString(e.NewValues["PackageType"]);
        e.NewValues["PackageType1"]  = SafeValue.SafeString(e.NewValues["PackageType"]);

        e.NewValues["Volume"]  = SafeValue.SafeDecimal(e.NewValues["Volume"], 0);
        e.NewValues["Weight"]  = SafeValue.SafeDecimal(e.NewValues["Weight"], 0);
        e.NewValues["Qty"]     = SafeValue.SafeInt(e.NewValues["Qty"], 0);
        e.NewValues["GrossWt"] = SafeValue.SafeDecimal(e.NewValues["GrossWt"], 0);
        e.NewValues["NetWt"]   = SafeValue.SafeDecimal(e.NewValues["NetWt"], 0);
        e.NewValues["Volume1"] = SafeValue.SafeDecimal(e.NewValues["Volume1"], 0);
        e.NewValues["Weight1"] = SafeValue.SafeDecimal(e.NewValues["Weight1"], 0);
        e.NewValues["Qty1"]    = SafeValue.SafeInt(e.NewValues["Qty1"], 0);
        e.NewValues["L"]       = SafeValue.SafeDecimal(e.NewValues["L"], 0);
        e.NewValues["W"]       = SafeValue.SafeDecimal(e.NewValues["W"], 0);
        e.NewValues["H"]       = SafeValue.SafeDecimal(e.NewValues["H"], 0);
        e.NewValues["L1"]      = SafeValue.SafeDecimal(e.NewValues["L1"], 0);
        e.NewValues["W1"]      = SafeValue.SafeDecimal(e.NewValues["W1"], 0);
        e.NewValues["H1"]      = SafeValue.SafeDecimal(e.NewValues["H1"], 0);
    }