コード例 #1
0
ファイル: MeetingTypeForm.xaml.cs プロジェクト: jjg0519/OA
 private void txtCycle_KeyUp(object sender, KeyEventArgs e)
 {
     GlobalFunction.TextBoxInputInt(sender, e, "CYCLEDAYS");
 }
コード例 #2
0
ファイル: RobotReply.cs プロジェクト: huucp/tuneRobo
        private void GetCurrentState()
        {
            var stateBytes = GlobalFunction.SplitByteArray(ReplyPacket, 12, 11);

            GlobalVariables.CurrentRobotState.UpdateState(stateBytes);
        }
コード例 #3
0
ファイル: RobotReply.cs プロジェクト: huucp/tuneRobo
 private int GetReplyID()
 {
     byte[] tmp = GlobalFunction.SplitByteArray(ReplyPacket, 8, 2);
     return(GlobalFunction.LE2ToDec(tmp));
 }
コード例 #4
0
ファイル: OrganAddForm.xaml.cs プロジェクト: jjg0519/OA
        //更新完成

        private void client_UpdateOrganCompleted(object sender, UpdateOrganCompletedEventArgs e)
        {
            RefreshUI(RefreshedTypes.HideProgressBar);
            try
            {
                if (e.Error == null)
                {
                    //HtmlPage.Window.Alert("机构信息修改成功!");
                    if (e.Result)
                    {
                        if (e.UserState.ToString() == "Edit")
                        {
                            Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("SUCCESSED"), Utility.GetResourceStr("MODIFYSUCCESSED"));
                            if (GlobalFunction.IsSaveAndClose(refreshType))
                            {
                                RefreshUI(refreshType);
                            }
                            else
                            {
                                InitData();
                            }
                        }
                        else if (e.UserState.ToString() == "Audit")
                        {
                            Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("SUCCESSED"), Utility.GetResourceStr("SUCCESSAUDIT"));
                        }
                        else if (e.UserState.ToString() == "Submit")
                        {
                            Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("SUCCESSED"), Utility.GetResourceStr("SUCCESSSUBMITAUDIT"));
                        }
                        RefreshUI(RefreshedTypes.All);



                        //if (actionFlag == DataActionFlag.SubmitFlow)
                        //{
                        //    //actionFlag = DataActionFlag.SubmitComplete;
                        //    SumbitFlow();
                        //}
                        //else
                        //{

                        //    if (actionFlag == DataActionFlag.SubmitComplete)
                        //    {
                        //        if (action == FormTypes.New || action == FormTypes.Edit)
                        //        {
                        //            Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("SUCCESSED"), Utility.GetResourceStr("SUBMITORGANREGISTERSUCCESSED"));
                        //        }
                        //        else
                        //        {
                        //            Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("SUCCESSED"), Utility.GetResourceStr("AUDITSUCCESSED", "ORGAN"));
                        //        }
                        //        RefreshUI(RefreshedTypes.CloseAndReloadData);

                        //    }
                        //    else
                        //    {
                        //        Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("SUCCESSED"), Utility.GetResourceStr("UPDATESUCCESSED", "ORGAN"));
                        //        if (GlobalFunction.IsSaveAndClose(refreshType))
                        //        {
                        //            RefreshUI(RefreshedTypes.CloseAndReloadData);
                        //        }
                        //        else
                        //        {
                        //            InitData();
                        //        }
                        //    }

                        //}
                    }
                    else
                    {
                        Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("UPDATEFAILED"));
                    }
                }
                else
                {
                    Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), e.Error.Message);
                }
            }
            catch (Exception ex)
            {
                Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), ex.Message.ToString());
            }
        }
コード例 #5
0
        //private void GenerateDataNomorAgendaSuratMasuk()
        //{
        //    DataTable dt = Data.SuratQuery.GetNomorAgenda("", 0, 0);
        //    for (int i = 0; i < dt.Rows.Count; i++)
        //    {
        //        ddLokasiFisikSurat.Items.Add(dt.Rows[i][0].ToString());
        //    }
        //}

        private void radButton2_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show(this, "Anda yakin akan mengubah data referensi surat?", "Konfirmasi", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes)
            {
                try
                {
                    if (!SuratQuery.IsSuratMasuk(GlobalFunction.SqlCharChecker(txtReferensiSurat.Text.Replace("\0", ""))))
                    {
                        MessageBox.Show(this, "Data surat referensi tidak ditemukan, silahkan cek kembali.", "Data Salah", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                        return;
                    }

                    SuratBusiness.ReferensiSuratKeluar(this.act, lblNomorAgenda.Text, GlobalFunction.SqlCharChecker(txtReferensiSurat.Text.Replace("\0", "")));
                    this.frmInfoSuratKeluar.lblReferensiSurat.Text = txtReferensiSurat.Text;
                    this.frmInfoSuratKeluar.lblReferensiSurat.Font = new Font("MS Reference Sans Serif", (float)9.75, FontStyle.Regular);
                    MessageBox.Show(this, "Data sudah disimpan.", "Informasi", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
                catch (Exception ex)
                { }
            }
        }
コード例 #6
0
ファイル: FrmEditSuratMasuk.cs プロジェクト: adheegm/desktop
        private void btnSimpan_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(lblNomorAgenda.Text.Replace("\0", "")))
            {
                MessageBox.Show(this, "\"Nomor Agenda\" tidak boleh kosong.", "Input Kosong", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                lblNomorAgenda.Focus();
                return;
            }

            if (!SuratQuery.IsSuratMasuk(lblNomorAgenda.Text.Replace("\0", "")))
            {
                MessageBox.Show(this, "Data surat tidak ditemukan.", "Input Kosong", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                lblNomorAgenda.Focus();
                return;
            }

            string values = "";

            if (MessageBox.Show(this, "Anda yakin akan melakukan perubahan pada data surat ini?", "Konfirmasi", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2)
                == System.Windows.Forms.DialogResult.No)
            {
                return;
            }

            if (txtNomorSurat.Text != drAsli[3].ToString())
            {
                SuratBusiness.EditSurat(this.nomor_agenda.Replace("\0", ""), "nomor_surat", GlobalFunction.SqlCharChecker(drAsli[3].ToString()),
                                        GlobalFunction.SqlCharChecker(txtNomorSurat.Text.Replace("\0", "")), T8UserLoginInfo.Username);
                values = values + " nomor_surat = '" + GlobalFunction.SqlCharChecker(txtNomorSurat.Text) + "' ";
            }
            if (string.Format("{0:yyyy-MM-dd}", dtTanggalSurat.Value) != string.Format("{0:yyyy-MM-dd}", (DateTime)drAsli[5]))
            {
                SuratBusiness.EditSurat(this.nomor_agenda.Replace("\0", ""), "tanggal_surat", string.Format("{0:yyyy-MM-dd}", (DateTime)drAsli[5]),
                                        string.Format("{0:yyyy-MM-dd}", dtTanggalSurat.Value), T8UserLoginInfo.Username);

                if (values != "")
                {
                    values = values + ",";
                }
                values = values + " tanggal_surat = '" + string.Format("{0:yyyy-MM-dd}", dtTanggalSurat.Value) + "' ";
            }

            if (txtAsalSurat.Text != drAsli[6].ToString())
            {
                SuratBusiness.EditSurat
                    (this.nomor_agenda, "asal_surat", GlobalFunction.SqlCharChecker(drAsli[6].ToString()), GlobalFunction.SqlCharChecker(txtAsalSurat.Text),
                    T8UserLoginInfo.Username);


                if (values != "")
                {
                    values = values + ",";
                }
                values = values + " asal_surat = '" + GlobalFunction.SqlCharChecker(txtAsalSurat.Text) + "' ";
            }

            if (txtPerihalSurat.Text != drAsli[7].ToString())
            {
                SuratBusiness.EditSurat
                    (this.nomor_agenda, "perihal", GlobalFunction.SqlCharChecker(drAsli[7].ToString()), GlobalFunction.SqlCharChecker(txtPerihalSurat.Text),
                    T8UserLoginInfo.Username);


                if (values != "")
                {
                    values = values + ",";
                }
                values = values + " perihal = '" + GlobalFunction.SqlCharChecker(txtPerihalSurat.Text) + "' ";
            }

            if (dropDownTingkatKeamanan.Text != drAsli[8].ToString())
            {
                SuratBusiness.EditSurat
                    (this.nomor_agenda, "tingkat_keamanan", drAsli[8].ToString(), dropDownTingkatKeamanan.Text, T8UserLoginInfo.Username);


                if (values != "")
                {
                    values = values + ",";
                }
                values = values + " tk_keamanan = '" + dropDownTingkatKeamanan.Text.Replace("'", "''") + "' ";
            }

            if (txtRingkasanIsi.Text != drAsli[9].ToString())
            {
                SuratBusiness.EditSurat
                    (this.nomor_agenda, "ringkasan_isi", GlobalFunction.SqlCharChecker(drAsli[9].ToString()), GlobalFunction.SqlCharChecker(txtRingkasanIsi.Text),
                    T8UserLoginInfo.Username);


                if (values != "")
                {
                    values = values + ",";
                }
                values = values + " ringkasan_isi = '" + GlobalFunction.SqlCharChecker(txtRingkasanIsi.Text) + "' ";
            }

            if (txtLampiran.Text != drAsli[10].ToString())
            {
                SuratBusiness.EditSurat
                    (this.nomor_agenda, "lampiran", GlobalFunction.SqlCharChecker(drAsli[10].ToString()), GlobalFunction.SqlCharChecker(txtLampiran.Text),
                    T8UserLoginInfo.Username);


                if (values != "")
                {
                    values = values + ",";
                }
                values = values + " lampiran = '" + GlobalFunction.SqlCharChecker(txtLampiran.Text) + "' ";
            }

            if (values == "")
            {
                return;
            }
            SuratBusiness.Update(this.nomor_agenda, values);

            this.frmMain.UpdateSurat(this, this.nomor_agenda.Replace("\0", ""));
            MessageBox.Show(this, "Data surat sudah di ubah.", "Update Sukses", MessageBoxButtons.OK, MessageBoxIcon.Information);
            clearInput();
        }
コード例 #7
0
ファイル: FrmInfoPengiriman.cs プロジェクト: adheegm/desktop
 private void radButton2_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(ddJenisPengiriman.Text))
     {
         try
         {
             if (this.frmDetailSurat != null)
             {
                 SuratBusiness.InsertJenisPengiriman(nomor_agenda, GlobalFunction.SqlCharChecker(ddJenisPengiriman.Text), GlobalFunction.SqlCharChecker(txtInfoPengiriman.Text));
                 MessageBox.Show(this, "Data pengiriman sudah diubah.", "Data disimpan", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 this.frmDetailSurat.BindingJenis();
                 this.Close();
             }
             else
             {
                 SuratBusiness.InsertJenisPengiriman(nomor_agenda, GlobalFunction.SqlCharChecker(ddJenisPengiriman.Text), GlobalFunction.SqlCharChecker(txtInfoPengiriman.Text));
                 MessageBox.Show(this, "Data pengiriman sudah diubah.", "Data disimpan", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 this.frmDetailSuratKeluar.BindingJenis();
                 this.Close();
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(this, ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         MessageBox.Show(this, "\"Jenis Pengiriman\" tidak boleh kosong.", "Data Belum lengkap.", MessageBoxButtons.OK, MessageBoxIcon.Stop);
         ddJenisPengiriman.Focus();
         return;
     }
 }
コード例 #8
0
ファイル: ConfAirportDatabase.cs プロジェクト: HanB2/GitLast
        // 공항코드 목록을 리턴한다
        public static List <ConfAirportModels> GetAirportDataList(int offset = 0, int limit = 0)
        {
            string sql1 = "select "
                          + "A.SEQNO"
                          + ", A.NATION_CODE"
                          + ", A.AIRPORT_CODE"
                          + ", A.AIRPORT_NAME"
                          + ", A.AIRPORT_LOCATION"

                          + ", N.NATIONNAME"
                          + ", N.NATIONNAME_ko_KR"
                          + ", N.NATIONNAME_zh_CN"

                          + " from conf_airport A"

                          + " left outer join comm_nation N"
                          + " on N.NATIONNO=A.NATION_CODE"

                          + " order by A.SEQNO"
                          + ((offset >= 0 && limit > 0) ? string.Format(" limit {0}, {1}", offset, limit) : "")
                          + "";

            string    err1 = "";
            DataTable dt1  = DatabaseConnection.GetDataTableMySQL(sql1, out err1);

            if (dt1 == null)
            {
                return(null);
            }



            // 현재 선택된 언어
            string org_language = System.Globalization.CultureInfo.CurrentCulture.Name;

            List <ConfAirportModels> AIRPORT_LIST = new List <ConfAirportModels>();

            for (int i = 0; i < dt1.Rows.Count; i++)
            {
                ConfAirportModels AIRPORT = new ConfAirportModels();

                AIRPORT.SEQNO            = GlobalFunction.GetInt(dt1.Rows[i]["SEQNO"].ToString().Trim()); //	int(10) unsigned	PRI	auto_increment	일련번호 (자동증가)
                AIRPORT.NATION_CODE      = dt1.Rows[i]["NATION_CODE"].ToString().Trim().ToUpper();        //	char(2)			국가코드
                AIRPORT.AIRPORT_CODE     = dt1.Rows[i]["AIRPORT_CODE"].ToString().Trim().ToUpper();       //	char(3)			공항코드
                AIRPORT.AIRPORT_NAME     = dt1.Rows[i]["AIRPORT_NAME"].ToString().Trim();                 //	varchar(50)			공항이름
                AIRPORT.AIRPORT_LOCATION = dt1.Rows[i]["AIRPORT_LOCATION"].ToString().Trim();             //	varchar(50)			공항위치

                // 커스텀 필드
                if (org_language == "ko-KR")
                {
                    AIRPORT.NATION_NAME = dt1.Rows[i]["NATIONNAME_ko_KR"].ToString().Trim();  // 국가명
                }
                else if (org_language == "zh-CN")
                {
                    AIRPORT.NATION_NAME = dt1.Rows[i]["NATIONNAME_zh_CN"].ToString().Trim();  // 국가명
                }
                else
                {
                    AIRPORT.NATION_NAME = dt1.Rows[i]["NATIONNAME"].ToString().Trim();  // 국가명
                }
                AIRPORT_LIST.Add(AIRPORT);
            }

            return(AIRPORT_LIST);
        }
コード例 #9
0
        private string GenerateFilter()
        {
            string filter = this.frmFilterSuratMasuk.patent_filter;

            if (chkNomorAgenda.Checked)
            {
                if (filter == "")
                {
                    filter = " where ";
                }
                else
                {
                    filter = filter + " and ";
                }
                filter = filter + " `nomor_agenda` like '%" + GlobalFunction.SqlCharChecker(txtNomorAgenda.Text) + "%' ";
            }
            if (chkTglInput.Checked)
            {
                if (filter != "")
                {
                    filter = filter + " and ";
                }
                else
                {
                    filter = " where ";
                }
                filter = filter + " Date(`datetime_input`) between '" + string.Format("{0:yyyy-MM-dd}", dtTglInput1.Value) + "' and '"
                         + string.Format("{0:yyyy-MM-dd}", dtTglInput2.Value) + "' ";
            }

            if (chkJamInput.Checked)
            {
                if (filter != "")
                {
                    filter = filter + " and ";
                }
                else
                {
                    filter = " where ";
                }
                filter = filter + " Time(`datetime_input`) between '" + string.Format("{0:HH:mm:ss}", dtJamInput1.Value) + "' and '"
                         + string.Format("{0:HH:mm:ss}", dtJamInput2.Value) + "' ";
            }

            if (chkKolom.Checked)
            {
                if (filter != "")
                {
                    filter = filter + " and ";
                }
                else
                {
                    filter = " where ";
                }
                filter = filter + " `kolom`='" + GlobalFunction.SqlCharChecker(ddKolom.Text) + "' ";
            }

            if (chkUserInput.Checked)
            {
                if (filter == "")
                {
                    filter = " where ";
                }
                else
                {
                    filter = filter + " and ";
                }
                filter = filter + " `user` like '%" + GlobalFunction.SqlCharChecker(txtUserInput.Text) + "%' ";
            }

            return(filter);
        }
コード例 #10
0
 private void toolStripButton2_Click(object sender, EventArgs e)
 {
     GlobalFunction.ExportExcelProcess(this.gvHistoryLoginUser);
 }
コード例 #11
0
        private void AddDownvote_Click(object sender, RoutedEventArgs e)
        {
            MainWindow window = GlobalFunction.GetMainWindow();

            window._addFrame.Navigate(new AddVote(false, studentId));
        }
コード例 #12
0
        public IActionResult UploadMaterialImage(List <IFormFile> files)
        {
            //string fileName = string.Empty;
            try
            {
                string fileName = Request.Form["fileName"];

                var filesPath = $"{this._hostingEnvironment.WebRootPath}\\img\\materials\\";

                if (!Directory.Exists(filesPath))
                {
                    Directory.CreateDirectory(filesPath);
                }

                foreach (var file in files)
                {
                    var fullFilePath = Path.Combine(filesPath, fileName);

                    if (file.Length <= 0)
                    {
                        continue;
                    }

                    GlobalFunction.SaveThumbnails(0.5, file.OpenReadStream(), fullFilePath);

                    //using (var image = Image.FromStream(file.OpenReadStream(), true, true))
                    //{
                    //    int newWidth, newHeight;

                    //    if (image.Width > 100 || image.Height > 100)
                    //    {
                    //        newWidth = (int)(image.Width * 0.5);
                    //        newHeight = (int)(image.Height * 0.5);
                    //    }
                    //    else
                    //    {
                    //        newWidth = image.Width;
                    //        newHeight = image.Height;
                    //    }

                    //    var thumbnailImg = new Bitmap(newWidth, newHeight);
                    //    var thumbGraph = Graphics.FromImage(thumbnailImg);
                    //    thumbGraph.CompositingQuality = CompositingQuality.HighQuality;
                    //    thumbGraph.SmoothingMode = SmoothingMode.HighQuality;
                    //    thumbGraph.InterpolationMode = InterpolationMode.HighQualityBicubic;
                    //    var imageRectangle = new Rectangle(0, 0, newWidth, newHeight);
                    //    thumbGraph.DrawImage(image, imageRectangle);
                    //    thumbnailImg.Save(fullFilePath, image.RawFormat);
                    //}

                    //using (var stream = new FileStream(fullFilePath, FileMode.Create))
                    //{
                    //    await file.CopyToAsync(stream);
                    //}
                }

                return(Json(new { success = true, data = fileName, message = files.Count + " Files Uploaded!" }));
            }
            catch (Exception ex)
            {
                return(BadRequest(new { success = false, message = ex.Message }));
            }
            //return this.Ok();
        }
コード例 #13
0
ファイル: MasterController.cs プロジェクト: weedkiller/sms
        public Int64 get_max_id(String tableName)
        {
            Int64 id = GlobalFunction.get_max_id(tableName);

            return(id);
        }
コード例 #14
0
ファイル: MeetingTypeForm.xaml.cs プロジェクト: jjg0519/OA
 private void txtRemindDay_KeyUp(object sender, KeyEventArgs e)
 {
     GlobalFunction.TextBoxInputInt(sender, e, "AHEADCAUTIONDAYS");
 }
コード例 #15
0
ファイル: HouseHireAppForm.xaml.cs プロジェクト: jjg0519/OA
        private void client_AddHireAppCompleted(object sender, AddHireAppCompletedEventArgs e)
        {
            RefreshUI(RefreshedTypes.HideProgressBar);
            try
            {
                if (e.Error == null)
                {
                    if (e.Result != "")
                    {
                        Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr(e.Result));
                    }
                    else
                    {
                        Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("SUCCESSED"), Utility.GetResourceStr("ADDDATASUCCESSED"));
                        if (GlobalFunction.IsSaveAndClose(refreshType))
                        {
                            RefreshUI(refreshType);
                        }
                        else
                        {
                            FormTypeAction = FormTypes.Edit;
                            action         = Action.Edit;
                            this.hireAppID = hireApp.HIREAPPID;
                            InitData();
                            EntityBrowser entBrowser = this.FindParentByType <EntityBrowser>();
                            entBrowser.FormType = FormTypes.Edit;
                            RefreshUI(RefreshedTypes.AuditInfo);
                            RefreshUI(RefreshedTypes.All);
                        }


                        //if (actionFlag == DataActionFlag.SubmitFlow)
                        //{
                        //    client.GetHireAppByIDAsync(hireApp.HIREAPPID);
                        //}
                        //else
                        //{
                        //    if (GlobalFunction.IsSaveAndClose(refreshType))
                        //    {
                        //        Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("SUCCESSED"), Utility.GetResourceStr("ADDSUCCESSED", "HOUSEHIREAPP"));
                        //        RefreshUI(refreshType);
                        //    }
                        //    else
                        //    {

                        //        Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("SUCCESSED"), Utility.GetResourceStr("ADDSUCCESSED", "HOUSEHIREAPP"));
                        //        this.action = Action.Edit;
                        //        this.hireAppID = hireApp.HIREAPPID;
                        //        InitData();
                        //    }
                        //}
                    }
                }
                else
                {
                    //HtmlPage.Window.Alert(e.ToString());

                    Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), e.Error.Message);
                }
            }
            catch (Exception ex)
            {
                Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), ex.ToString());
            }
        }
コード例 #16
0
        public ResponseBase InsertOrUpdate(UserModel model)
        {
            ResponseBase result = null;

            try
            {
                using (var db = new IEDEntities())
                {
                    result = new ResponseBase();
                    SUser     obj         = null;
                    SUserRole userRoleObj = null;
                    if (CheckName(model.UserName, model.Id, db))
                    {
                        result.IsSuccess = false;
                        result.Errors.Add(new Error()
                        {
                            Message = "Tên đăng nhập đã tồn tại. Vui lòng chọn lại tên khác!", MemberName = "Thêm Mới"
                        });
                    }
                    else
                    {
                        if (model.Id == 0)
                        {
                            #region add user
                            obj = new SUser();
                            Parse.CopyObject(model, ref obj);
                            if (!string.IsNullOrEmpty(model.ImagePath))
                            {
                                obj.ImagePath = model.ImagePath != "0" ? model.ImagePath.Split(',').ToList().First() : null;
                            }
                            obj.IsLock             = false;
                            obj.IsRequireChangePW  = true;
                            obj.NoteForgotPassword = null;
                            obj.PassWord           = GlobalFunction.EncryptMD5(model.PassWord);
                            obj.CreatedUser        = model.ActionUser;
                            obj.CreatedDate        = DateTime.Now;
                            obj.CompanyId          = model.CompanyId;
                            obj.SUserRoles         = new Collection <SUserRole>();

                            if (model.NoteForgotPassword != null)
                            {
                                foreach (var item in model.NoteForgotPassword.Split(',').ToList())
                                {
                                    userRoleObj             = new SUserRole();
                                    userRoleObj.RoleId      = int.Parse(item);
                                    userRoleObj.CreatedDate = obj.CreatedDate;
                                    userRoleObj.CreatedUser = obj.CreatedUser;
                                    userRoleObj.SUser       = obj;
                                    obj.SUserRoles.Add(userRoleObj);
                                }
                            }
                            db.SUsers.Add(obj);
                            #endregion
                        }
                        else
                        {
                            obj = db.SUsers.FirstOrDefault(x => !x.IsDeleted && x.Id == model.Id);
                            if (obj != null)
                            {
                                #region update user detail
                                if (!string.IsNullOrEmpty(model.PassWord))
                                {
                                    obj.PassWord = obj.IsRequireChangePW ? GlobalFunction.EncryptMD5(model.PassWord) : obj.PassWord;
                                }

                                obj.FisrtName          = model.FisrtName;
                                obj.LastName           = model.LastName;
                                obj.NoteForgotPassword = null;
                                if (model.ImagePath != null && model.ImagePath != "0")
                                {
                                    obj.ImagePath = model.ImagePath.Split(',').ToList().First();
                                }
                                obj.Email       = model.Email;
                                obj.UpdatedUser = model.ActionUser;
                                obj.UpdatedDate = DateTime.Now;
                                #endregion

                                var       oldRoles = db.SUserRoles.Where(x => !x.IsDeleted && x.UserId == model.Id);
                                SUserRole userRole;
                                if (model.NoteForgotPassword != null)
                                {
                                    model.UserRoleIds = model.NoteForgotPassword.Split(',').Select(x => Convert.ToInt32(x)).ToList();
                                    #region sử lý nếu list user role new != null
                                    if (oldRoles != null && oldRoles.Count() > 0)
                                    {
                                        string query = "";
                                        foreach (var oldItem in oldRoles)
                                        {
                                            //var userRoleFind = model.UserRoleIds.Find(x => x == oldItem.Id);
                                            //if (userRoleFind == 0)
                                            //{
                                            //    oldItem.IsDeleted = true;
                                            //    oldItem.DeletedUser = obj.UpdatedUser;
                                            //    oldItem.DeletedDate = obj.UpdatedDate;
                                            //}
                                            //else
                                            //    model.UserRoleIds.Remove(userRoleFind);

                                            query += " update SUserRole set IsDeleted=1 where Id=" + oldItem.Id;
                                        }
                                        if (!string.IsNullOrEmpty(query))
                                        {
                                            db.Database.ExecuteSqlCommand(query);
                                        }

                                        if (model.UserRoleIds != null && model.UserRoleIds.Count > 0)
                                        {
                                            foreach (var item in model.UserRoleIds)
                                            {
                                                userRoleObj             = new SUserRole();
                                                userRoleObj.RoleId      = item;
                                                userRoleObj.CreatedDate = DateTime.Now;
                                                userRoleObj.CreatedUser = model.ActionUser;
                                                userRoleObj.UserId      = model.Id;
                                                obj.SUserRoles.Add(userRoleObj);
                                            }
                                        }
                                    }
                                    else
                                    {
                                        foreach (var item in model.NoteForgotPassword.Split(',').Select(x => Convert.ToInt32(x)).ToList())
                                        {
                                            userRoleObj             = new SUserRole();
                                            userRoleObj.RoleId      = item;
                                            userRoleObj.CreatedDate = DateTime.Now;
                                            userRoleObj.CreatedUser = model.ActionUser;
                                            userRoleObj.UserId      = model.Id;
                                            obj.SUserRoles.Add(userRoleObj);
                                        }
                                    }

                                    #endregion
                                }
                                else
                                {
                                    #region sử lý nếu list user role new is null
                                    foreach (var oldItem in oldRoles)
                                    {
                                        oldItem.IsDeleted   = true;
                                        oldItem.DeletedUser = obj.UpdatedUser;
                                        oldItem.DeletedDate = obj.UpdatedDate;
                                    }
                                    #endregion
                                }
                            }
                            else
                            {
                                result.IsSuccess = false;
                                result.Errors.Add(new Error()
                                {
                                    MemberName = "Update Account", Message = "Tài Khoản đang thao tác không tồn tại. Vui lòng kiểm tra lại!"
                                });
                            }
                        }
                        db.SaveChanges();
                        result.IsSuccess = true;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
コード例 #17
0
ファイル: HouseHireAppForm.xaml.cs プロジェクト: jjg0519/OA
        private void client_UpdateHireAppCompleted(object sender, UpdateHireAppCompletedEventArgs e)
        {
            RefreshUI(RefreshedTypes.HideProgressBar);
            try
            {
                if (e.Error == null)
                {
                    if (e.Result != "")
                    {
                        Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr(e.Result));
                    }
                    else
                    {
                        if (e.UserState.ToString() == "Edit")
                        {
                            if (FromFormFlag == "1") //入住操作  修改完ISOK之后 需要添加一条出租记录
                            {
                                AddHireRecord();
                            }
                            else
                            {
                                Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("SUCCESSED"), Utility.GetResourceStr("MODIFYSUCCESSED"));
                                if (GlobalFunction.IsSaveAndClose(refreshType))
                                {
                                    RefreshUI(refreshType);
                                }
                                else
                                {
                                    InitData();
                                }
                            }
                        }
                        else if (e.UserState.ToString() == "Audit")
                        {
                            Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("SUCCESSED"), Utility.GetResourceStr("SUCCESSAUDIT"));
                        }
                        else if (e.UserState.ToString() == "Submit")
                        {
                            Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("SUCCESSED"), Utility.GetResourceStr("SUCCESSSUBMITAUDIT"));
                        }
                        RefreshUI(RefreshedTypes.All);



                        ////HtmlPage.Window.Alert("修改房源记录成功!");
                        //if (actionFlag == DataActionFlag.SubmitFlow)
                        //{
                        //    //actionFlag = DataActionFlag.SubmitComplete;
                        //    SumbitFlow();
                        //}
                        //else
                        //{
                        //    RefreshUI(RefreshedTypes.ProgressBar);
                        //    if (actionFlag == DataActionFlag.SubmitComplete)
                        //    {
                        //        if (action == Action.Add || action == Action.Edit)
                        //        {
                        //            Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("SUCCESSED"), Utility.GetResourceStr("SUBMITHOUSEHIREAPPSUCCESSED"));
                        //        }
                        //        else
                        //        {
                        //            Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("SUCCESSED"), Utility.GetResourceStr("AUDITSUCCESSED", "HOUSEHIREAPP"));
                        //        }
                        //    }
                        //    else
                        //    {
                        //        if (FromFormFlag == "1") //入住操作  修改完ISOK之后 需要添加一条出租记录
                        //        {
                        //            AddHireRecord();
                        //        }
                        //        else
                        //        {
                        //            if (GlobalFunction.IsSaveAndClose(refreshType))
                        //            {
                        //                Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("SUCCESSED"), Utility.GetResourceStr("UPDATESUCCESSED", "HOUSEHIREAPP"));
                        //            }
                        //            else
                        //            {
                        //                Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("SUCCESSED"), Utility.GetResourceStr("UPDATESUCCESSED", "HOUSEHIREAPP"));
                        //                InitData();
                        //            }
                        //        }
                        //    }
                        //    RefreshUI(refreshType);
                        //}
                    }
                }
                else
                {
                    Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), e.Error.Message);
                }
            }
            catch (Exception ex)
            {
                Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), ex.ToString());
            }
        }
コード例 #18
0
 private void TextBlock_KeyUp(object sender, KeyEventArgs e)
 {
     GlobalFunction.TextBoxInputDecimal(sender, e);
 }
コード例 #19
0
 /// <summary>
 /// Добавить глобальную функцию в движок
 /// </summary>
 public void addGlobalFunction(string functionName, GlobalFunction function)
 {
     globalFunctions.Add(functionName, function);
 }
コード例 #20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserLogin"] == null)
            {
                Session.Clear();
                Session.Abandon();
                ViewState.Clear();
                FormsAuthentication.SignOut();

                Response.Redirect("~/Account/Login.aspx");
            }
            else
            {
                if (!IsPostBack)
                {
                    string _projectNo = string.Empty;
                    _projectNo = Request.QueryString["ProjectNo"];

                    if (!string.IsNullOrEmpty(_projectNo))
                    {
                        GlobalFunction fDecrypt = new GlobalFunction();
                        hdfProjectNo.Value = fDecrypt.Decrypt(_projectNo);

                        MAS_COMPANYUSER_DTO retUser = (MAS_COMPANYUSER_DTO)Session["UserLogin"];
                        if (retUser.RolesNo > 0)
                        {
                            hdfCompanyNo.Value = retUser.CompanyNo.ToString().Trim();
                            hdfUserName.Value  = retUser.UserName;
                            hdfUserNo.Value    = retUser.UsersNo.ToString().Trim();
                            hdfRoleNo.Value    = retUser.RolesNo.ToString();

                            if (retUser.RolesNo == 2)
                            {
                                if (!retUser.ProjectNo.ToString().Trim().Equals(hdfProjectNo.Value.Trim()))
                                {
                                    Session.Clear();
                                    Session.Abandon();
                                    ViewState.Clear();
                                    FormsAuthentication.SignOut();

                                    Response.Redirect("~/Account/Login.aspx");
                                }
                            }
                        }

                        ViewState["PathFile"]        = null;
                        ViewState["TemplateNo"]      = string.Empty;
                        ViewState["TemplateColName"] = null;
                        ViewState["tbAttachFile"]    = null;

                        GetProjectBidding();
                    }
                    else
                    {
                        Session.Clear();
                        Session.Abandon();
                        ViewState.Clear();
                        FormsAuthentication.SignOut();

                        Response.Redirect("~/Account/Login.aspx");
                    }
                }
                else
                {
                    string _templateNo = (string)ViewState["TemplateNo"];
                    BindItemProject(_templateNo);
                }
            }
        }
コード例 #21
0
ファイル: OrganAddForm.xaml.cs プロジェクト: jjg0519/OA
        //新增完成
        public void client_AddOrganCompleted(object sender, AddOrganCompletedEventArgs e)
        {
            RefreshUI(RefreshedTypes.HideProgressBar);
            try
            {
                if (!e.Cancelled)//if (e.Error == null)
                {
                    if (e.Error == null)
                    {
                        if (e.Result != "")
                        {
                            Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr(e.Result));
                        }
                        else
                        {
                            Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("SUCCESSED"), Utility.GetResourceStr("ADDDATASUCCESSED"));
                            if (GlobalFunction.IsSaveAndClose(refreshType))
                            {
                                RefreshUI(refreshType);
                            }
                            else
                            {
                                action = FormTypes.Edit;

                                InitData();
                                EntityBrowser entBrowser = this.FindParentByType <EntityBrowser>();
                                entBrowser.FormType = FormTypes.Edit;
                                RefreshUI(RefreshedTypes.AuditInfo);
                                RefreshUI(RefreshedTypes.All);
                            }



                            //if (actionFlag == DataActionFlag.SubmitFlow)
                            //{
                            //    this.action = FormTypes.Edit;
                            //    SumbitFlow();
                            //}
                            //else
                            //{

                            //    Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("SUCCESSED"), Utility.GetResourceStr("ADDSUCCESSED", "ORGAN"));
                            //    if (GlobalFunction.IsSaveAndClose(refreshType))
                            //    {
                            //        RefreshUI(refreshType);
                            //    }
                            //    else
                            //    {
                            //        this.action = FormTypes.Edit;
                            //        InitData();
                            //    }

                            //}
                        }
                    }
                    else
                    {
                        Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), e.Error.Message);
                    }
                }
                else
                {
                    Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), e.Error.Message);
                }
            }
            catch (Exception ex)
            {
                Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), ex.Message.ToString());
            }
        }
コード例 #22
0
        //Ad
        private void CreateNewModule()
        {
            string ProjectPath = ProjectSelector.Directory;
            string ModuleName  = NewModuleName.InputText;
            bool   IsEditor    = ModuleType_SB.Select_CB.SelectedValue.ToString().Equals("Editor");

            GlobalFunction.RemoveDirectoryIfValid(ProjectPath + "/Saved");
            GlobalFunction.RemoveDirectoryIfValid(ProjectPath + "/Intermediate");
            GlobalFunction.RemoveDirectoryIfValid(ProjectPath + "/.vs");
            GlobalFunction.RemoveDirectoryIfValid(ProjectPath + "/Binaries");

            #region Uproject
            string FullUProject = File.ReadAllText(ProjectSelector.FullPathAndFile);
            string NewUProject  = "," + Environment.NewLine + GlobalFunction.FindResourceTextFile("BoilerplateUproject");

            NewUProject = NewUProject.Replace("NameOfModule", ModuleName);
            NewUProject = NewUProject.Replace("ModuleType", ModuleType_SB.Select_CB.SelectedValue.ToString());
            NewUProject = NewUProject.Replace("LoadingPhaseType", LoadingPhases_Sb.Select_CB.SelectedValue.ToString());

            //Can cause issues when using plugins. Preferred solution would convert to JSON
            MatchCollection ResultsUProject = Regex.Matches(FullUProject, @"}", RegexOptions.Singleline);
            FullUProject = FullUProject.Insert(ResultsUProject[ResultsUProject.Count - 2].Index + 1, NewUProject);
            File.WriteAllText(ProjectSelector.FullPathAndFile, FullUProject);
            #endregion

            #region File Structure / Startup Shutdown class
            string NewDirectory = ProjectPath + "/Source/" + ModuleName;
            Directory.CreateDirectory(NewDirectory);
            Directory.CreateDirectory(NewDirectory + "/Public");
            Directory.CreateDirectory(NewDirectory + "/Private");

            string BuildFile = GlobalFunction.FindResourceTextFile("BoilerplateModule.Build").Replace("BoilerplateModule", ModuleName);
            BuildFile = BuildFile.Replace("BoilerplateNameOfProject", ProjectSelector.FileName);

            //Only include UnrealEd if creating a editor class
            if (!IsEditor)
            {
                BuildFile = BuildFile.Replace(", \"UnrealEd\"", "");
            }

            //Swap to new ModuleManager include path if needed
            string PublicFile = GlobalFunction.FindResourceTextFile("BoilerplateStartUpH").Replace("BoilerplateModule", ModuleName);
            if (FourTwentyFive_CB.IsChecked)
            {
                PublicFile = PublicFile.Replace("#include \"ModuleManager.h\"", "#include \"Modules/ModuleManager.h\"");
            }

            string PrivateFile = GlobalFunction.FindResourceTextFile("BoilerplateStartUpCPP").Replace("BoilerplateModule", ModuleName);

            File.WriteAllText(NewDirectory + "/" + ModuleName + ".build.cs", BuildFile);
            File.WriteAllText(NewDirectory + "/Public/" + ModuleName + ".h", PublicFile);
            File.WriteAllText(NewDirectory + "/Private/" + ModuleName + ".cpp", PrivateFile);
            #endregion

            #region Game Target Files
            string TargetGame       = File.ReadAllText(ProjectPath + "/Source/" + ProjectSelector.FileName + ".Target.cs");
            string TargetGameEditor = File.ReadAllText(ProjectPath + "/Source/" + ProjectSelector.FileName + "Editor.Target.cs");

            string NewTarget = GlobalFunction.FindResourceTextFile("BoilerplateTargetFile");
            NewTarget = NewTarget.Replace("BoilerplateModule", ModuleName);

            MatchCollection Results       = Regex.Matches(TargetGame, @"}", RegexOptions.Singleline);
            string          NewTargetGame = TargetGame.Insert(Results[Results.Count - 2].Index, NewTarget + Environment.NewLine + "\t");

            Results = Regex.Matches(TargetGameEditor, @"}", RegexOptions.Singleline);
            string NewTargetGameEditor = TargetGameEditor.Insert(Results[Results.Count - 2].Index, NewTarget + Environment.NewLine + "\t");

            File.WriteAllText(ProjectPath + "/Source/" + ProjectSelector.FileName + "Editor.Target.cs", NewTargetGameEditor);
            if (!IsEditor)
            {
                File.WriteAllText(ProjectPath + "/Source/" + ProjectSelector.FileName + ".Target.cs", NewTargetGame);
            }
            #endregion
        }
コード例 #23
0
 void OnVisit()
 {
     GlobalFunction.WeHavntDone();
 }
コード例 #24
0
    public override void DrawCell(int index, int count = 0)
    {
        base.DrawCell(index, count);
        var      dataList = sanctuaryPackage.GetBuildingCostList();
        NCostDef cost     = dataList[index];
        bool     isEnough = true;

        if (cost.configID == 1)
        {
            nameLabel.text  = string.Format("庄园等级限制:");
            valueLabel.text = string.Format("{0}/{1}", cost.value, userPackage.GetManorLevel());
            if (userPackage.GetManorLevel() < cost.value)
            {
                isEnough = false;
            }
        }
        else if (cost.configID == 2)
        {
            nameLabel.text  = string.Format("黄金:");
            valueLabel.text = string.Format("{0}/{1}", cost.value, GlobalFunction.NumberFormat(itemPackage.GetGoldNumber()));
            if (itemPackage.GetGoldNumber() < cost.value)
            {
                isEnough = false;
            }
        }
        else if (cost.configID == 3)
        {
            nameLabel.text  = string.Format("电力:");
            valueLabel.text = string.Format("{0}/{1}", cost.value, GlobalFunction.NumberFormat(itemPackage.GetElecNumber()));
            if (itemPackage.GetElecNumber() < cost.value)
            {
                isEnough = false;
            }
        }
        else
        {
            ITEM_RES itemData = itemPackage.GetItemDataByConfigID(cost.configID);
            if (itemData == null)
            {
                return;
            }
            nameLabel.text = string.Format("{0}:", itemData.MinName);
            NItemInfo itemInfo = itemPackage.GetItemInfo(cost.configID);
            if (itemInfo == null)
            {
                valueLabel.text = string.Format("{0}/{1}", cost.value, 0);
                isEnough        = false;
            }
            else
            {
                valueLabel.text = string.Format("{0}/{1}", cost.value, GlobalFunction.NumberFormat(itemInfo.number));
                if (itemInfo.number < cost.value)
                {
                    isEnough = false;
                }
            }
        }
        if (isEnough)
        {
            nameLabel.color  = Color.white;
            valueLabel.color = Color.white;
        }
        else
        {
            nameLabel.color  = Color.red;
            valueLabel.color = Color.red;
        }
    }
コード例 #25
0
        public void LoadChart()
        {
            DataTable ldtbTable = new DataTable();

            chart1.Series.Clear();
            chart1.ChartAreas[0].AxisY.Minimum = 0;
            chart1.ChartAreas[0].Name          = "Expenses";

            string query = GlobalFunction.GetQueryById(Constant.Query.LOAD_EXPENSES_CHART);

            query     = string.Format(query, parameter1, parameter2);
            ldtbTable = DBFunction.FetchDataFromDatabase(Constant.Common.DATABASE_NAME, query);

            if (Convert.ToString(cmbChartType.SelectedItem) == "Monthly")
            {
                string month = string.Empty;
                if (cmbMonth.SelectedItem != null)
                {
                    month = Convert.ToString(cmbMonth.SelectedItem.GetType().GetProperty("Text").GetValue(cmbMonth.SelectedItem, null));
                }
                else
                {
                    month = DateTime.Now.ToString("MMMM");
                }
                chart1.Series.Add(month);
                if (ldtbTable.Rows.Count > 0)
                {
                    chart1.ChartAreas[0].AxisY.Maximum = ldtbTable.AsEnumerable().Select(x => x.Field <int>(Constant.Common.Alias.AMOUNT)).Max().GetCeilingNumber(1000);
                    foreach (DataRow dr in ldtbTable.Rows)
                    {
                        chart1.Series[month].Points.AddXY(dr["Expenses_Category_Name"], dr[Constant.Common.Alias.AMOUNT]);
                    }
                }
                else
                {
                    query = "Select Expenses_Category_Id, Expenses_Category_Name, '0'  Amount from Expenses_Category";
                    chart1.ChartAreas[0].AxisY.Maximum = 100;
                    ldtbTable = DBFunction.FetchDataFromDatabase(Constant.Common.DATABASE_NAME, query);
                    if (ldtbTable.Rows.Count > 0)
                    {
                        foreach (DataRow dr in ldtbTable.Rows)
                        {
                            chart1.Series[month].Points.AddXY(dr["Expenses_Category_Name"], dr["Amount"]);
                        }
                    }
                }
            }
            else if (Convert.ToString(cmbChartType.SelectedItem) == "Quarterly")
            {
                List <string> monthname = new List <string>();
                string        month     = string.Empty;
                if (cmbMonth.SelectedItem != null)
                {
                    month     = Convert.ToString(cmbMonth.SelectedItem.GetType().GetProperty("Value").GetValue(cmbMonth.SelectedItem, null));
                    monthname = GlobalFunction.GetMonthNameFromQuarter(Convert.ToInt32(month));
                    chart1.Series.Add(monthname[0]);
                    chart1.Series.Add(monthname[1]);
                    chart1.Series.Add(monthname[2]);
                }
                else
                {
                    month = DateTime.Now.ToString("MMMM");
                }

                if (ldtbTable.Rows.Count > 0)
                {
                    chart1.ChartAreas[0].AxisY.Maximum = ldtbTable.AsEnumerable().Select(x => x.Field <int>("Amount")).Max().GetCeilingNumber(1000);
                    foreach (string mon in monthname)
                    {
                        int       iMonthNo      = Convert.ToDateTime("01-" + mon.Substring(0, 3) + "-2020").Month;
                        DataRow[] ldtbTableTemp = ldtbTable.Select("Months = '" + iMonthNo + "'");
                        if (ldtbTableTemp.Count() > 0)
                        {
                            foreach (DataRow dr in ldtbTableTemp)
                            {
                                chart1.Series[mon].Points.AddXY(dr["Expenses_Category_Name"], dr["Amount"]);
                            }
                        }
                    }
                }
                else
                {
                    query     = "Select Expenses_Category_Id, Expenses_Category_Name, '0'  Amount from Expenses_Category";
                    ldtbTable = DBFunction.FetchDataFromDatabase(Constant.Common.DATABASE_NAME, query);
                    if (ldtbTable.Rows.Count > 0)
                    {
                        foreach (string mon in monthname)
                        {
                            foreach (DataRow dr in ldtbTable.Rows)
                            {
                                chart1.Series[mon].Points.AddXY(dr["Expenses_Category_Name"], dr["Amount"]);
                            }
                        }
                    }
                }
            }
        }
コード例 #26
0
ファイル: ProdDbModels.cs プロジェクト: HanB2/GitLast
        public PROD_EXCEL UploadExcelProd(PROD_EXCEL model)
        {
            HttpContext context = HttpContext.Current;
            string      eseCode = context.Session["ESE_CODE"].ToString();
            string      estCode = context.Session["EST_CODE"].ToString();

            model.result = true;

            string         error_str = "";
            GlobalFunction comModel  = new GlobalFunction();
            DataTable      data      = comModel.getUploadExcelData(model.File.FILE, out error_str);

            model.errList = new List <string>();

            if (error_str != "")
            {
                model.errList.Add(error_str);
                model.result = false;
                return(model);
            }



            //유효성 검사
            if (data != null && data.Rows.Count != 0)
            {
                for (int i = 0; i < data.Rows.Count; i++)
                {
                    //  0,1 필수 :: 7, 8 더블 :: 10 인트


                    if (data.Rows[i][0].ToString().Trim() == "")                        //필수값 체크
                    {
                        model.errList.Add("[" + i + "] - " + comm_global.Language.Resources.Script_RequiredInput + "[" + comm_global.Language.Resources.ESE_Comm_Barcord + "]");
                        error_str = "error";
                    }
                    if (data.Rows[i][1].ToString().Trim() == "")                        //필수값 체크
                    {
                        model.errList.Add("[" + i + "] - " + comm_global.Language.Resources.Script_RequiredInput + "[" + comm_global.Language.Resources.ESE_Comm_PRODUCT_NAME + "]");
                        error_str = "error";
                    }

                    try
                    {
                        Convert.ToDouble(data.Rows[i][7].ToString().Trim());                            //더블형 체크
                    }
                    catch
                    {
                        model.errList.Add("[" + i + "] - " + comm_global.Language.Resources.Script_DoubleInput + "[" + comm_global.Language.Resources.ESE_ProdAdd_UNIT_WEIGHT + "]");
                        error_str = "error";
                    }

                    /*
                     * try
                     * {
                     *      Convert.ToDouble(data.Rows[i][8].ToString().Trim());	//더블형 체크
                     * }
                     * catch
                     * {
                     *      model.errList.Add("[" + i + "] - " + comm_global.Language.Resources.Script_DoubleInput + "[" + comm_global.Language.Resources.ESE_ProdAdd_viewWEIGHT_UNIT + "]");
                     *      error_str = "error";
                     * }
                     */
                    try
                    {
                        int.Parse(data.Rows[i][10].ToString().Trim());                            //인트 체크
                    }
                    catch
                    {
                        model.errList.Add("[" + i + "] - " + comm_global.Language.Resources.Script_IntInput + "[" + comm_global.Language.Resources.ESE_ProdAdd_EXPIRATION + "]");
                        error_str = "error";
                    }

                    string str_queryErr = "";
                    //바코드 중복 체크
                    string chkQuery = " SELECT COUNT(*) as cnt FROM stc_goods WHERE ESE_CODE = '" + eseCode + "' AND BARCODE = '" + data.Rows[i][0].ToString().Trim() + "' ";
                    if (getQueryCnt(chkQuery, out str_queryErr) > 0)
                    {
                        model.errList.Add("[" + i + "] - " + comm_global.Language.Resources.Script_OverLappedProd);
                        error_str = "error";
                    }
                }
            }

            if (error_str == "error")
            {
                model.result = false;
                return(model);
            }


            string        exeQueryStr = "";
            List <string> linqList    = new List <string>();
            string        tmpQuery    = "";

            exeQueryStr = " INSERT INTO stc_goods (EST_CODE, ESE_CODE, BARCODE, PRODUCT_NAME, PRODUCT_NAME_KR, PRODUCT_NAME_CN, PRODUCT_NAME_EN ,SKU, BRAND, UNIT_WEIGHT, WEIGHT_UNIT, STANDARD, EXPIRATION, ORIGIN, INGREDIENT, SPEC, SALE_SITE_URL, PRODUCT_IMAGE ) VALUES ";

            if (data != null && data.Rows.Count != 0)
            {
                for (int i = 0; i < data.Rows.Count; i++)
                {
                    //  0,1 필수 :: 7, 8 더블 :: 10 인트
                    tmpQuery  = "( '" + estCode + "', " + "'" + eseCode + "'";
                    tmpQuery += ", '" + data.Rows[i][0].ToString().Trim() + "'";
                    tmpQuery += ", '" + data.Rows[i][1].ToString().Trim() + "'";
                    tmpQuery += ", '" + data.Rows[i][2].ToString().Trim() + "'";
                    tmpQuery += ", '" + data.Rows[i][3].ToString().Trim() + "'";
                    tmpQuery += ", '" + data.Rows[i][4].ToString().Trim() + "'";
                    tmpQuery += ", '" + data.Rows[i][5].ToString().Trim() + "'";
                    tmpQuery += ", '" + data.Rows[i][6].ToString().Trim() + "'";
                    tmpQuery += ", " + data.Rows[i][7].ToString().Trim();
                    tmpQuery += ", '" + data.Rows[i][8].ToString().Trim() + "'";
                    tmpQuery += ", '" + data.Rows[i][9].ToString().Trim() + "'";
                    tmpQuery += ", " + data.Rows[i][10].ToString().Trim();
                    tmpQuery += ", '" + data.Rows[i][11].ToString().Trim() + "'";
                    tmpQuery += ", '" + data.Rows[i][12].ToString().Trim() + "'";
                    tmpQuery += ", '" + data.Rows[i][13].ToString().Trim() + "'";
                    tmpQuery += ", '" + data.Rows[i][14].ToString().Trim() + "'";
                    tmpQuery += ", '" + data.Rows[i][15].ToString().Trim() + "' )";

                    linqList.Add(tmpQuery);
                }
            }

            exeQueryStr += string.Join(",", linqList);
            model.result = exeQuery(exeQueryStr, out error_str);

            return(model);
        }
コード例 #27
0
ファイル: RobotReply.cs プロジェクト: huucp/tuneRobo
 private byte[] ProcessInformationRequest()
 {
     return(GlobalFunction.SplitByteArray(ReplyPacket, 12, ReplyPacket.Length - 12));
 }
コード例 #28
0
ファイル: DatabaseConnection.cs プロジェクト: HanB2/GitLast
 // DB Connection string 을 리턴한다
 static public string GetDBConnStr()
 {
     return(GlobalFunction.AESDecrypt_256(DBCONN_STR_NEW, MAIN_KEY));
 }
コード例 #29
0
        protected void btnRegister_Click(object sender, EventArgs e)
        {
            logger.Info("btnRegister_Click (Start)");
            string _phoneNo = ConfigurationManager.GetConfiguration().GulfPhoneNo;

            try
            {
                if (IsValid)
                {
                    Int64? _iCompanyNo = null;
                    string _sCompanyNo = hdfRetCompanyNo.Value.Trim();
                    if (!string.IsNullOrEmpty(_sCompanyNo))
                    {
                        _iCompanyNo = Convert.ToInt64(_sCompanyNo);
                    }

                    MAS_BIDDINGCOMPANY data = new MAS_BIDDINGCOMPANY();
                    data.CompanyName    = txtCompanyName.Text.Trim();
                    data.TaxID          = txtTaxID.Text.Trim();
                    data.CompanyAddress = txtCompanyAdd.Text.Trim();
                    data.ContactName    = txtContactPerson.Text.Trim();
                    data.MobilePhoneNo  = txtMobilePhone.Text.Trim();
                    data.TelephoneNo    = txtPhoneNo.Text.Trim();
                    data.Email          = txtEmail.Text.Trim();
                    data.EmailCC        = txtEmailCC.Text.Trim();
                    data.CreatedDate    = DateTime.Now;
                    data.CreatedBy      = GetIPAddress();
                    data.UpdatedDate    = DateTime.Now;
                    data.UpdatedBy      = GetIPAddress();

                    data.CompanyWebsite = txtCompanyWebsite.Text.Trim();
                    data.CompanyType    = ddlUserType.SelectedValue.Trim();
                    data.CompanyNo      = _iCompanyNo;

                    /************************** For Set PAssword ***********************/
                    MAS_USERS      userData     = new MAS_USERS();
                    int            _length      = int.Parse(ConfigurationManager.GetConfiguration().PasswordLength);
                    GlobalFunction func         = new GlobalFunction();
                    string         _password    = func.RandomDefaultPass(_length);
                    string         _encryptPass = func.Encrypt(_password);

                    userData.Password = _encryptPass;
                    //userData.UserName = txtEmail.Text.Trim();
                    userData.RolesNo     = 2; //Role for Company or Vendor!!
                    userData.CreatedDate = DateTime.Now;
                    userData.CreatedBy   = GetIPAddress();
                    userData.UpdatedDate = DateTime.Now;
                    userData.UpdatedBy   = GetIPAddress();

                    userData.Status = "Not Verify";

                    userData.ProjectNo = Convert.ToInt64(ddlBDProject.SelectedValue);
                    hdfProjectNo.Value = ddlBDProject.SelectedValue;
                    /*******************************************************************/
                    Mas_BiddingCompany_Manage manage = new Mas_BiddingCompany_Manage();
                    string strRetInsUser             = manage.RegisterCompany(data, userData);

                    if (!string.IsNullOrWhiteSpace(strRetInsUser))
                    {
                        hdfCompanyNo.Value = strRetInsUser.Split(';')[0].ToString().Trim();

                        /************ Insert Attach File **************/
                        string _companyNo = strRetInsUser.Split(';')[0].ToString().Trim();
                        List <MAS_COMPANYATTACHMENT> lAttach = new List <MAS_COMPANYATTACHMENT>();
                        lAttach = SetCompanyFileUpload(_companyNo);
                        bool result = manage.InsertCompanyAttach(lAttach);
                        /**********************************************/
                        if (result)
                        {
                            /***************************** Old Version *********************************/
                            /************** Send Email UserName & Password ***************/
                            string _userName = strRetInsUser.Split(';')[1].ToString().Trim();
                            string sBody     = GenEmailBody(_userName, _password);

                            //SendMailUserPassword(sBody, data.Email);
                            INF_EMIALVENDOR mailData = new INF_EMIALVENDOR();
                            mailData.EmailTo       = data.Email;
                            mailData.EmailBody     = sBody;
                            Session["EmailVendor"] = mailData;
                            /*************************************************************/

                            //******************* Case Crate Success ******************//
                            //lblMsgResult1.Text = "ท่านได้ทำการลงทะเบียนเรียบร้อย ระบบจะจัดส่งข้อมูลผู้ใช้งานให้ทางอีเมล์ที่ได้ลงทะเบียนไว้";
                            //lblMsgResult2.Text = "หากไม่ได้รับอีเมล์ภายใน 1 วันสามารถติดต่อได้ที่เบอร์โทร " + _phoneNo;
                            //lbtnPopup_ModalPopupExtender.Show();

                            string _encryCompanyNo = "";
                            string _encryProjectNo = "";
                            _encryCompanyNo = hdfCompanyNo.Value.Trim();
                            _encryProjectNo = hdfProjectNo.Value.Trim();
                            //_encryCompanyNo = GlobalFunction.EncryptParam(hdfCompanyNo.Value.Trim());
                            //_encryProjectNo = GlobalFunction.EncryptParam(hdfProjectNo.Value.Trim());

                            Session["RegDetail"] = _encryCompanyNo + ":" + _encryProjectNo;

                            /***************************** Old Version *********************************/

                            //string _urlDestination = "~/Form/Questionnaire.aspx?Company=" + _encryCompanyNo + "&Project=" + _encryProjectNo;
                            string _urlDestination = "~/Form/Questionnaire.aspx";
                            Response.Redirect(_urlDestination);
                            //*********************************************************//
                        }
                        else
                        {
                            lblMsgResult1.Text = "ไม่สามารถแก้ไขรหัสผ่านได้! ";
                            lblMsgResult2.Text = "กรุณาติดต่อผู้ดูแลระบบที่เบอร์โทร " + _phoneNo;
                            this.lbtnPopup_ModalPopupExtender.Show();
                        }
                    }
                    else
                    {
                        lblMsgResult1.Text = "ไม่สามารถบันทึกข้อมูลได้! ";
                        lblMsgResult2.Text = "กรุณาติดต่อผู้ดูแลระบบที่เบอร์โทร " + _phoneNo;
                        this.lbtnPopup_ModalPopupExtender.Show();
                    }
                }

                logger.Info("btnRegister_Click (End)");
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                logger.Error(ex.StackTrace);

                lblMsgResult1.Text = "ไม่สามารถแก้ไขรหัสผ่านได้! ";
                lblMsgResult2.Text = "กรุณาติดต่อผู้ดูแลระบบที่เบอร์โทร " + _phoneNo;

                this.lbtnPopup_ModalPopupExtender.Show();
            }
        }
コード例 #30
0
ファイル: LicenseBorrowForm.xaml.cs プロジェクト: jjg0519/OA
        /// <summary>
        ///  新增完成
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void client_AddLicenseBorrowCompleted(object sender, AddLicenseBorrowCompletedEventArgs e)
        {
            RefreshUI(RefreshedTypes.HideProgressBar);
            try
            {
                if (e.Error == null)
                {
                    if (!string.IsNullOrEmpty(e.Result))
                    {
                        Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr(e.Result));
                    }
                    else
                    {
                        //HtmlPage.Window.Alert("新增外借记录成功!");
                        Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("SUCCESSED"), Utility.GetResourceStr("ADDDATASUCCESSED"));
                        if (GlobalFunction.IsSaveAndClose(refreshType))
                        {
                            RefreshUI(refreshType);
                        }
                        else
                        {
                            formTypeAction = FormTypes.Edit;
                            EntityBrowser entBrowser = this.FindParentByType <EntityBrowser>();
                            entBrowser.FormType = FormTypes.Edit;
                            this.action         = Action.Edit;
                            this.licenseID      = licenseObj.LICENSEUSERID;
                            client.GetLicenseBorrowListByIdAsync(licenseID);
                        }


                        //if (actionFlag == DataActionFlag.SubmitFlow)
                        //{
                        //    client.GetLicenseBorrowListByIdAsync(licenseObj.LICENSEUSERID);
                        //}
                        //else
                        //{
                        //    RefreshUI(RefreshedTypes.ProgressBar);
                        //    if (GlobalFunction.IsSaveAndClose(refreshType))
                        //    {
                        //        Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("SUCCESSED"), Utility.GetResourceStr("ADDSUCCESSED", "LICENSELENDING"));
                        //        //todo: close and refresh
                        //        RefreshUI(refreshType);
                        //    }
                        //    else
                        //    {
                        //        Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("SUCCESSED"), Utility.GetResourceStr("ADDSUCCESSED", "LICENSELENDING"));
                        //        this.action = Action.Edit;
                        //        this.licenseID = licenseObj.LICENSEUSERID;
                        //        client.GetLicenseBorrowListByIdAsync(licenseID);
                        //    }
                        //}
                    }
                }
                else
                {
                    Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), e.Error.Message);
                }
            }
            catch (Exception ex)
            {
                Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), ex.Message.ToString());
            }
        }