コード例 #1
0
        protected void PoPuP(object sender, DirectEventArgs e)
        {
            panelRecordDetails.ActiveIndex = 0;
            DeactivatePassword(true);
            userGroups.Disabled = false;
            int    id   = Convert.ToInt32(e.ExtraParams["id"]);
            string type = e.ExtraParams["type"];

            CurrentUser.Text = id.ToString();
            switch (type)
            {
            case "imgEdit":
                //Step 1 : get the object from the Web Service
                RecordRequest r = new RecordRequest();
                r.RecordID = id.ToString();

                RecordResponse <UserInfo> response = _systemService.ChildGetRecord <UserInfo>(r);
                if (!response.Success)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    Common.errorMessage(response);
                    return;
                }
                //Step 2 : call setvalues with the retrieved object

                PasswordConfirmation.Text = response.result.password;
                this.BasicInfoTab.SetValues(response.result);
                if (response.result.activeStatus == Convert.ToInt16(ActiveStatus.INACTIVE))
                {
                    isInactiveCheck.Checked = true;
                }
                else
                {
                    isInactiveCheck.Checked = false;
                }


                if (!String.IsNullOrEmpty(response.result.employeeId))
                {
                    RecordRequest empRecord = new RecordRequest();
                    empRecord.RecordID = response.result.employeeId;
                    RecordResponse <Employee> empResponse = _employeeService.Get <Employee>(empRecord);

                    RecordRequest req = new RecordRequest();

                    employeeId.GetStore().Add(new object[]
                    {
                        new
                        {
                            recordId = response.result.employeeId,
                            fullName = empResponse.result.name.fullName
                        }
                    });
                    employeeId.SetValue(response.result.employeeId);

                    X.Call("SetNameEnabled", false, empResponse.result.name.fullName);
                }
                pro.Hidden = true;

                // InitCombos(response.result);
                this.EditRecordWindow.Title = Resources.Common.EditWindowsTitle;
                this.EditRecordWindow.Show();


                AllGroupsStore.Reload();
                break;

            case "imgDelete":
                X.Msg.Confirm(Resources.Common.Confirmation, Resources.Common.DeleteOneRecord, new MessageBoxButtonsConfig
                {
                    Yes = new MessageBoxButtonConfig
                    {
                        //We are call a direct request metho for deleting a record
                        Handler = String.Format("App.direct.DeleteRecord({0})", id),
                        Text    = Resources.Common.Yes
                    },
                    No = new MessageBoxButtonConfig
                    {
                        Text = Resources.Common.No
                    }
                }).Show();
                break;

            case "imgAttach":

                //Here will show up a winow relatice to attachement depending on the case we are working on
                break;

            default:
                break;
            }
        }
コード例 #2
0
ファイル: WorkFlows.aspx.cs プロジェクト: EliasTous/ERP
        protected void SaveNewWSRecord(object sender, DirectEventArgs e)
        {
            //Getting the id to check if it is an Add or an edit as they are managed within the same form.


            string       obj   = e.ExtraParams["values"];
            string       seqNO = e.ExtraParams["seqNO"];
            WorkSequence b     = JsonConvert.DeserializeObject <WorkSequence>(obj);

            b.approverPositionName = approverPosition.SelectedItem.Text;
            b.branchName           = branchId.SelectedItem.Text;
            b.departmentName       = departmentId.SelectedItem.Text;
            if (string.IsNullOrEmpty(seqNO))
            {
                b.seqNo = null;
            }
            else
            {
                b.seqNo = Convert.ToInt32(seqNO);
            }


            // Define the object to add or edit as null

            if (string.IsNullOrEmpty(seqNO))
            {
                try
                {
                    PostRequest <WorkSequence> request = new PostRequest <WorkSequence>();
                    request.entity      = b;
                    request.entity.wfId = currentWorkFlowId.Text;
                    if (string.IsNullOrEmpty(currentSeq.Text))
                    {
                        request.entity.seqNo = 1;
                        currentSeq.Text      = "1";
                    }
                    else
                    {
                        request.entity.seqNo = Convert.ToInt32(currentSeq.Text) + 1;
                        currentSeq.Text      = (Convert.ToInt32(currentSeq.Text) + 1).ToString();
                    }

                    PostResponse <WorkSequence> r = _companyStructureRepository.ChildAddOrUpdate <WorkSequence>(request);
                    if (!r.Success)
                    {
                        Common.errorMessage(r);
                        return;
                    }

                    FillWorkSequenceStore(currentWorkFlowId.Text);
                    Notification.Show(new NotificationConfig
                    {
                        Title = Resources.Common.Notification,
                        Icon  = Icon.Information,
                        Html  = Resources.Common.RecordSavingSucc
                    });

                    this.EditWSWindow.Close();
                }
                catch (Exception ex)
                {
                    //Error exception displaying a messsage box
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorSavingRecord).Show();
                }
            }
            else
            {
                //Update Mode

                try
                {
                    PostRequest <WorkSequence> request = new PostRequest <WorkSequence>();
                    request.entity      = b;
                    request.entity.wfId = currentWorkFlowId.Text;



                    PostResponse <WorkSequence> r = _companyStructureRepository.ChildAddOrUpdate <WorkSequence>(request);
                    if (!r.Success)
                    {
                        Common.errorMessage(r);
                        return;
                    }


                    Notification.Show(new NotificationConfig
                    {
                        Title = Resources.Common.Notification,
                        Icon  = Icon.Information,
                        Html  = Resources.Common.RecordUpdatedSucc
                    });
                    FillWorkSequenceStore(currentWorkFlowId.Text);
                    this.EditWSWindow.Close();
                }
                catch (Exception ex)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
                }
            }
        }
コード例 #3
0
        protected void SaveNewRecord(object sender, DirectEventArgs e)
        {
            //Getting the id to check if it is an Add or an edit as they are managed within the same form.
            string id = e.ExtraParams["id"];

            string obj = e.ExtraParams["values"];
            AssetManagementSupplier b = JsonConvert.DeserializeObject <AssetManagementSupplier>(obj);

            b.recordId = id;
            // Define the object to add or edit as null

            if (string.IsNullOrEmpty(id))
            {
                try
                {
                    //New Mode
                    //Step 1 : Fill The object and insert in the store
                    PostRequest <AssetManagementSupplier> request = new PostRequest <AssetManagementSupplier>();
                    request.entity = b;
                    PostResponse <AssetManagementSupplier> r = _assetManagementService.ChildAddOrUpdate <AssetManagementSupplier>(request);
                    b.recordId = r.recordId;

                    //check if the insert failed
                    if (!r.Success)//it maybe be another condition
                    {
                        //Show an error saving...

                        Common.errorMessage(r);
                        return;
                    }
                    else
                    {
                        //Add this record to the store
                        this.Store1.Insert(0, b);

                        //Display successful notification
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordSavingSucc
                        });

                        this.EditRecordWindow.Close();
                        RowSelectionModel sm = this.GridPanel1.GetSelectionModel() as RowSelectionModel;
                        sm.DeselectAll();
                        sm.Select(b.recordId.ToString());
                    }
                }
                catch (Exception ex)
                {
                    //Error exception displaying a messsage box
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorSavingRecord).Show();
                }
            }
            else
            {
                //Update Mode

                try
                {
                    int index = Convert.ToInt32(id);//getting the id of the record
                    PostRequest <AssetManagementSupplier> request = new PostRequest <AssetManagementSupplier>();
                    request.entity = b;
                    PostResponse <AssetManagementSupplier> r = _assetManagementService.ChildAddOrUpdate <AssetManagementSupplier>(request);                      //Step 1 Selecting the object or building up the object for update purpose

                    //Step 2 : saving to store

                    //Step 3 :  Check if request fails
                    if (!r.Success)//it maybe another check
                    {
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
                        return;
                    }
                    else
                    {
                        ModelProxy record = this.Store1.GetById(index);
                        BasicInfoTab.UpdateRecord(record);
                        record.Commit();
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordUpdatedSucc
                        });
                        this.EditRecordWindow.Close();
                    }
                }
                catch (Exception ex)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
                }
            }
        }
コード例 #4
0
        protected void SaveOverrideNewRecord(object sender, DirectEventArgs e)
        {
            //Getting the id to check if it is an Add or an edit as they are managed within the same form.
            System.Threading.Thread.CurrentThread.CurrentCulture   = new CultureInfo("en");
            System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo("en");
            try
            {
                string obj        = e.ExtraParams["values"];
                string clockStamp = e.ExtraParams["clockStamp"];
                string shiftId    = e.ExtraParams["shiftId"];
                string employeeId = e.ExtraParams["employeeId"];
                string recordId   = e.ExtraParams["recordId"];

                OverrideTimeVariation b = JsonConvert.DeserializeObject <OverrideTimeVariation>(obj);


                RecordRequest recReq = new RecordRequest();
                recReq.RecordID = recordId;
                //recReq.employeeId = employeeId.ToString();
                //recReq.dayId = dtFrom.SelectedDate.ToString("yyyyMMdd");
                //recReq.shiftId = shiftId;
                //recReq.timeCode = b.timeCode.ToString();
                RecordResponse <DashBoardTimeVariation> recResp = _timeAttendanceService.ChildGetRecord <DashBoardTimeVariation>(recReq);

                if (!recResp.Success)
                {
                    Common.errorMessage(recResp);
                    return;
                }

                PostRequest <OverrideTimeVariation> req = new PostRequest <OverrideTimeVariation>();
                req.entity          = b;
                req.entity.apStatus = recResp.result.apStatus.ToString();

                req.entity.clockDuration = recResp.result.clockDuration.ToString();
                req.entity.damageLevel   = recResp.result.damageLevel.ToString();
                req.entity.duration      = recResp.result.duration.ToString();
                req.entity.shiftId       = shiftId;
                req.entity.employeeId    = recResp.result.employeeId.ToString();
                req.entity.date          = recResp.result.date;
                req.entity.recordId      = recordId;
                DateTime temp = DateTime.Now;
                if (DateTime.TryParse(clockStamp, out temp))
                {
                    req.entity.clockStamp = temp;
                }
                else
                {
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
                }
                PostResponse <OverrideTimeVariation> resp = _timeAttendanceService.ChildAddOrUpdate <OverrideTimeVariation>(req);
                if (!resp.Success)
                {
                    Common.errorMessage(resp);
                    return;
                }

                Store1.Reload();
                Notification.Show(new NotificationConfig
                {
                    Title = Resources.Common.Notification,
                    Icon  = Icon.Information,
                    Html  = Resources.Common.RecordUpdatedSucc
                });
                overrideWindow.Close();
                InitializeCulture();
            }


            catch (Exception ex)
            {
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
            }
        }
コード例 #5
0
ファイル: Approvals.aspx.cs プロジェクト: EliasTous/ERP
        protected void PoPuP(object sender, DirectEventArgs e)
        {
            string id   = e.ExtraParams["id"];
            string type = e.ExtraParams["type"];

            apId.Text = id;
            panelRecordDetails.ActiveIndex = 0;
            approvalFlowStore.DataSource   = Common.XMLDictionaryList(_systemService, "29");
            approvalFlowStore.DataBind();

            //departmentId.Select("");
            //     ApprovelDepartmentsStore.Reload();

            switch (type)
            {
            case "imgEdit":
                //Step 1 : get the object from the Web Service
                RecordRequest r = new RecordRequest();
                r.RecordID = id;

                RecordResponse <Approval> response = _companyStructureService.ChildGetRecord <Approval>(r);
                if (!response.Success)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    Common.errorMessage(response);
                    return;
                }
                //Step 2 : call setvalues with the retrieved object
                this.BasicInfoTab.SetValues(response.result);


                this.EditRecordWindow.Title = Resources.Common.EditWindowsTitle;
                //ApprovelDepartmentsGrid.Disabled = false;
                this.EditRecordWindow.Show();
                break;

            case "imgDelete":
                X.Msg.Confirm(Resources.Common.Confirmation, Resources.Common.DeleteOneRecord, new MessageBoxButtonsConfig
                {
                    Yes = new MessageBoxButtonConfig
                    {
                        //We are call a direct request metho for deleting a record
                        Handler = String.Format("App.direct.DeleteRecord({0})", id),
                        Text    = Resources.Common.Yes
                    },
                    No = new MessageBoxButtonConfig
                    {
                        Text = Resources.Common.No
                    }
                }).Show();
                break;

            case "imgAttach":

                //Here will show up a winow relatice to attachement depending on the case we are working on
                break;

            default:
                break;
            }
        }
コード例 #6
0
        protected void SaveNewReceiverRecord(object sender, DirectEventArgs e)
        {
            //Getting the id to check if it is an Add or an edit as they are managed within the same form.

            if (!pdf.Checked && !xls.Checked && !csv.Checked)
            {
                X.Msg.Alert(Resources.Common.Error, (string)GetLocalResourceObject("SelectPay")).Show();
                return;
            }

            string   obj = e.ExtraParams["values"];
            Receiver b   = new Receiver();//JsonConvert.DeserializeObject<Receiver>(obj);

            string id    = e.ExtraParams["taskId"];
            string seqNo = e.ExtraParams["seqNo"];

            if (id != "")
            {
                b.taskId = Convert.ToInt32(id);
            }
            if (seqNo != "")
            {
                b.seqNo = Convert.ToInt32(seqNo);
            }

            b.receiverType = Convert.ToInt32(receiverType.SelectedItem.Value);
            if (Convert.ToInt32(receiverType.SelectedItem.Value) == 2)
            {
                sgId.SelectedItem.Value = "0";
            }

            if (Convert.ToInt32(sgId.SelectedItem.Value) == 0)
            {
                b.sgId = null;
            }
            else
            {
                b.sgId = Convert.ToInt32(sgId.SelectedItem.Value);
            }

            b.email = email.Text;

            if (languageId.SelectedItem.Value == null)
            {
                b.languageId = null;
            }
            else
            {
                b.languageId = Convert.ToInt32(languageId.SelectedItem.Value);
            }

            b.pdf = pdf.Checked;
            b.xls = xls.Checked;
            b.csv = csv.Checked;

            // Define the object to add or edit as null

            //if (string.IsNullOrEmpty(b.taskId.ToString()))// && string.IsNullOrEmpty(b.message))
            if (b.taskId.ToString() == "0")
            {
                try
                {
                    //New Mode
                    //Step 1 : Fill The object and insert in the store
                    PostRequest <Receiver> request = new PostRequest <Receiver> ();

                    request.entity        = b;
                    request.entity.taskId = Convert.ToInt32(currentRuId.Text);
                    if (lineSeq.Text == "")
                    {
                        request.entity.seqNo = 1;
                    }
                    else
                    {
                        request.entity.seqNo = Convert.ToInt32(lineSeq.Text);
                    }

                    //request.entity.ruleId = currentRuId.Text;
                    PostResponse <Receiver> r = _taskScheduleService.ChildAddOrUpdate <Receiver>(request);


                    //check if the insert failed
                    if (!r.Success)//it maybe be another condition
                    {
                        //Show an error saving...
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        Common.errorMessage(r);
                        return;
                    }
                    else
                    {
                        //Add this record to the store
                        FillReceiverStore();

                        this.receiversWindow.Close();
                        //Display successful notification
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordSavingSucc
                        });
                    }
                }
                catch (Exception ex)
                {
                    //Error exception displaying a messsage box
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorSavingRecord).Show();
                }
            }
            else
            {
                //Update Mode

                try
                {
                    //getting the id of the record
                    PostRequest <Receiver> request = new PostRequest <Receiver>();
                    request.entity = b;
                    //request.entity.ruleId = currentRuId.Text;

                    PostResponse <Receiver> r = _taskScheduleService.ChildAddOrUpdate <Receiver>(request);                      //Step 1 Selecting the object or building up the object for update purpose

                    //Step 2 : saving to store

                    //Step 3 :  Check if request fails
                    if (!r.Success)//it maybe another check
                    {
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        Common.errorMessage(r);
                        return;
                    }
                    else
                    {
                        //FillMessageStore();
                        this.receiversWindow.Close();
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordUpdatedSucc
                        });

                        FillReceiverStore();
                    }
                }
                catch (Exception ex)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
                }
            }
        }
コード例 #7
0
        protected void FillTimeApproval(int dayId, int employeeId, string timeCode, string shiftId)
        {
            try
            {
                string rep_params = "";
                Dictionary <string, string> parameters = new Dictionary <string, string>();
                parameters.Add("1", employeeId.ToString());
                parameters.Add("2", dayId.ToString());
                parameters.Add("3", dayId.ToString());
                parameters.Add("4", shiftId);
                parameters.Add("5", timeCode);
                parameters.Add("6", "0");
                parameters.Add("7", "0");
                parameters.Add("8", "0");
                parameters.Add("9", "0");
                parameters.Add("10", "0");
                foreach (KeyValuePair <string, string> entry in parameters)
                {
                    rep_params += entry.Key.ToString() + "|" + entry.Value + "^";
                }
                if (rep_params.Length > 0)
                {
                    if (rep_params[rep_params.Length - 1] == '^')
                    {
                        rep_params = rep_params.Remove(rep_params.Length - 1);
                    }
                }



                ReportGenericRequest req = new ReportGenericRequest();
                req.paramString = rep_params;



                ListResponse <Time> Times = _timeAttendanceService.ChildGetAll <Time>(req);
                if (!Times.Success)
                {
                    Common.errorMessage(Times);
                    return;
                }
                List <XMLDictionary> timeCodeList = ConstTimeVariationType.TimeCodeList(_systemService);
                int currentTimeCode;
                Times.Items.ForEach(x =>
                {
                    if (Int32.TryParse(x.timeCode, out currentTimeCode))
                    {
                        x.timeCodeString = timeCodeList.Where(y => y.key == Convert.ToInt32(x.timeCode)).Count() != 0 ? timeCodeList.Where(y => y.key == Convert.ToInt32(x.timeCode)).First().value : string.Empty;
                    }

                    x.statusString = FillApprovalStatus(x.status);
                });

                TimeStore.DataSource = Times.Items;
                ////List<ActiveLeave> leaves = new List<ActiveLeave>();
                //leaves.Add(new ActiveLeave() { destination = "dc", employeeId = 8, employeeName = new Model.Employees.Profile.EmployeeName() { fullName = "vima" }, endDate = DateTime.Now.AddDays(10) });


                TimeStore.DataBind();
            }
            catch (Exception exp)
            {
                X.Msg.Alert(Resources.Common.Error, exp.Message).Show();
            }
        }
コード例 #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest && !IsPostBack)
            {
                SetExtLanguage();
                HideShowButtons();
                try
                {
                    AccessControlApplier.ApplyAccessControlOnPage(typeof(MyInfo), BasicInfoTab, null, null, SaveButton);
                }
                catch (AccessDeniedException exp)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorAccessDenied, "closeCurrentTab()").Show();

                    return;
                }

                if (string.IsNullOrEmpty(_systemService.SessionHelper.GetCurrentUserId().ToString()))
                {
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorOperation).Show();
                }

                //RecordRequest r = new RecordRequest();
                //r.RecordID = _systemService.SessionHelper.GetCurrentUserId();
                //RecordResponse<UserInfo> response = _systemService.ChildGetRecord<UserInfo>(r);
                //if (!response.Success)
                //{
                //    X.Msg.Alert(Resources.Common.Error, GetGlobalResourceObject("Errors", response.ErrorCode) != null ? GetGlobalResourceObject("Errors", response.ErrorCode).   ToString() +"<br>"+GetGlobalResourceObject("Errors", "ErrorLogId") + response.LogId : response.Summary, "closeCurrentTab()").Show();
                //    return;
                //}
                CurrentEmployee.Text = _systemService.SessionHelper.GetEmployeeId();
                // EditRecordWindow.Loader.Params("employeeId") = CurrentEmployee.Text;

                RecordRequest req = new RecordRequest();
                req.RecordID = CurrentEmployee.Text;
                RecordResponse <MyInfo> resp = _iselfServiceService.ChildGetRecord <MyInfo>(req);
                if (!resp.Success)
                {
                    Common.errorMessage(resp);
                    return;
                }
                FillReligionStore();
                if (resp.result != null)
                {
                    if (resp.result.name != null)
                    {
                        resp.result.familyName = resp.result.name.familyName;
                        resp.result.middleName = resp.result.name.middleName;
                        resp.result.firstName  = resp.result.name.firstName;
                        resp.result.lastName   = resp.result.name.lastName;
                        resp.result.reference  = resp.result.name.reference;
                        resp.result.fullName   = resp.result.name.fullName;
                    }

                    BasicInfoTab.Reset();
                    BasicInfoTab.SetValues(resp.result);
                }
                this.EditRecordWindow.Title = Resources.Common.EditWindowsTitle;
                this.EditRecordWindow.Show();



                //try
                //{
                //   // AccessControlApplier.ApplyAccessControlOnPage(typeof(HireInfo), actualPanel, null, null, saveButton);

                //}
                //catch (AccessDeniedException exp)
                //{
                //    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                //    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorAccessDenied).Show();

                //    return;
                //}
                ////if (recruitmentInfo.InputType == InputType.Password)
                ////{
                ////    recruitmentInfo.Visible = false;
                ////    infoField.Visible = true;
                ////}
            }
        }
コード例 #9
0
        protected void RefreshProgress(object sender, DirectEventArgs e)
        {
            try
            {
                double progress = 0;
                if (HttpRuntime.Cache.Get("ErrorMsgGenAD") != null || HttpRuntime.Cache.Get("ErrorLogIdGenAD") != null)
                {
                    X.Msg.Alert(Resources.Common.Error, HttpRuntime.Cache.Get("ErrorMsgGenAD").ToString() + "<br>" + GetGlobalResourceObject("Errors", "ErrorLogId") + HttpRuntime.Cache.Get("ErrorLogIdGenAD").ToString()).Show();


                    this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                    HttpRuntime.Cache.Remove("genFS_RecordId");
                    HttpRuntime.Cache.Remove("ErrorMsgGenAD");
                    HttpRuntime.Cache.Remove("ErrorLogIdGenAD");
                }

                if (!Common.isThreadSafe())
                {
                    this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                    HttpRuntime.Cache.Remove("isThreadSafe");
                    Common.errorMessage(null);
                }
                else
                {
                    Common.increasThreadSafeCounter();
                }
                RecordRequest req = new RecordRequest();
                if (HttpRuntime.Cache["genFS_RecordId"] != null)
                {
                    req.RecordID = HttpRuntime.Cache["genFS_RecordId"].ToString();
                }
                else
                {
                    return;
                }
                RecordResponse <BackgroundJob> resp = _systemService.ChildGetRecord <BackgroundJob>(req);
                if (resp.result == null || resp.result.errorId != null)
                {
                    //string[] values;
                    //var infolist = resp.result.infoList.Split(',');
                    //string ErrorMessage;
                    //if (GetGlobalResourceObject("Errors", "Error_" + resp.result.errorId) != null)

                    //    values = GetGlobalResourceObject("Errors", "Error_" + resp.result.errorId).ToString().Split(new string[] { "%s" }, StringSplitOptions.None);
                    //    for (int i = 0; i < infolist.Length; i++)
                    //    {

                    //        values[0] += infolist[i] + "  ";
                    //    }
                    //    if (values.Length == 2)
                    //        ErrorMessage = values[0] + " " + values[1];
                    //    else
                    //        ErrorMessage = values[0];
                    //}
                    //else
                    //    ErrorMessage = GetGlobalResourceObject("Errors", "Error_2").ToString() + resp.ErrorCode;


                    //X.Msg.Alert(Resources.Common.Error, ErrorMessage).Show();
                    if (resp.result.errorId != null)
                    {
                        X.MessageBox.Alert(Resources.Common.Error, resp.result.errorName + "<br>" + Resources.Errors.ErrorLogId + resp.result.errorId + "<br>").Show();
                    }
                    else
                    {
                        Common.errorMessage(resp);
                    }


                    this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                    HttpRuntime.Cache.Remove("genFS_RecordId");
                    HttpRuntime.Cache.Remove("ErrorMsgGenAD");
                    HttpRuntime.Cache.Remove("ErrorLogIdGenAD");
                }
                else
                {
                    if (resp.result.taskSize == 0)
                    {
                        progress = 0;
                        this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                        X.Msg.Alert("", GetGlobalResourceObject("Common", "GenerateAttendanceDaySucc").ToString()).Show();
                    }
                    else
                    {
                        progress = (double)resp.result.completed / resp.result.taskSize;
                        string prog    = (float.Parse(progress.ToString()) * 100).ToString();
                        string message = GetGlobalResourceObject("Common", "working").ToString();
                        this.Progress1.UpdateProgress(float.Parse(progress.ToString()), string.Format(message + " {0}%", (int)(float.Parse(progress.ToString()) * 100)));
                    }


                    if (resp.result.taskSize == resp.result.completed)
                    {
                        this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                        HttpRuntime.Cache.Remove("genFS_RecordId");
                        X.Msg.Alert("", GetGlobalResourceObject("Common", "GenerateAttendanceDaySucc").ToString()).Show();
                    }
                }
            }
            catch (Exception exp)
            {
                this.ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", this.TaskManager1.ClientID);
                X.Msg.Alert(Resources.Common.Error, exp.Message).Show();
            }
        }
コード例 #10
0
        protected void SaveNewRecord(object sender, DirectEventArgs e)
        {
            //Getting the id to check if it is an Add or an edit as they are managed within the same form.
            string id = e.ExtraParams["id"];

            string          obj = e.ExtraParams["values"];
            EmployeePenalty b   = JsonConvert.DeserializeObject <EmployeePenalty>(obj);

            //if (referToPositionId.SelectedItem != null)
            //    b.referToPositionName = referToPositionId.SelectedItem.Text;
            //if (tsId.SelectedItem != null)
            //    b.tsName = tsId.SelectedItem.Text;
            b.recordId = CurrentpenaltyId.Text;
            // Define the object to add or edit as null
            b.apStatus = string.IsNullOrEmpty(b.apStatus) ? "1" : b.apStatus;
            if (string.IsNullOrEmpty(CurrentpenaltyId.Text))
            {
                try
                {
                    //New Mode
                    //Step 1 : Fill The object and insert in the store
                    PostRequest <EmployeePenalty> request = new PostRequest <EmployeePenalty>();
                    request.entity = b;
                    PostResponse <EmployeePenalty> r = _employeeService.ChildAddOrUpdate <EmployeePenalty>(request);


                    //check if the insert failed
                    if (!r.Success)//it maybe be another condition
                    {
                        //Show an error saving...
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        Common.errorMessage(r);;
                        return;
                    }
                    else
                    {
                        b.recordId = r.recordId;
                        //Add this record to the store
                        Store1.Reload();
                        CurrentpenaltyId.Text = b.recordId;

                        //Display successful notification
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordSavingSucc
                        });


                        RowSelectionModel sm = this.GridPanel1.GetSelectionModel() as RowSelectionModel;
                        sm.DeselectAll();
                        sm.Select(b.recordId.ToString());
                    }
                }
                catch (Exception ex)
                {
                    //Error exception displaying a messsage box
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorSavingRecord).Show();
                }
            }
            else
            {
                //Update Mode

                try
                {
                    //getting the id of the record
                    PostRequest <EmployeePenalty> request = new PostRequest <EmployeePenalty>();
                    request.entity = b;
                    b.recordId     = CurrentpenaltyId.Text;
                    PostResponse <EmployeePenalty> r = _employeeService.ChildAddOrUpdate <EmployeePenalty>(request);                   //Step 1 Selecting the object or building up the object for update purpose

                    //Step 2 : saving to store

                    //Step 3 :  Check if request fails
                    if (!r.Success)//it maybe another check
                    {
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        Common.errorMessage(r);
                        return;
                    }
                    else
                    {
                        Store1.Reload();
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordUpdatedSucc
                        });
                        this.EditRecordWindow.Close();
                    }
                }
                catch (Exception ex)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
                }
            }
        }
コード例 #11
0
        //private List<Employee> GetEmployeesFiltered(string query)
        //{

        //    EmployeeListRequest req = new EmployeeListRequest();
        //    req.DepartmentId = "0";
        //    req.BranchId = "0";
        //    req.IncludeIsInactive = 2;
        //    req.SortBy = GetNameFormat();

        //    req.StartAt = "0";
        //    req.Size = "20";
        //    req.Filter = query;

        //    ListResponse<Employee> response = _employeeService.GetAll<Employee>(req);
        //    return response.Items;
        //}


        //private string GetNameFormat()
        //{
        //    return _systemService.SessionHelper.Get("nameFormat").ToString();
        //}

        protected void ApprovalsStore_ReadData(object sender, StoreReadDataEventArgs e)
        {
            //EmployeePenaltyApprovalListRequest req = new EmployeePenaltyApprovalListRequest();



            if (string.IsNullOrEmpty(CurrentpenaltyId.Text))
            {
                ApprovalStore.DataSource = new List <EmployeePenaltyApproval>();
                ApprovalStore.DataBind();
                return;
            }


            string rep_params = "";
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("1", "0");
            parameters.Add("2", "0");
            parameters.Add("3", "0");
            parameters.Add("4", "0");
            parameters.Add("5", "0");
            parameters.Add("6", "0");
            parameters.Add("7", "0");
            parameters.Add("8", CurrentpenaltyId.Text);

            foreach (KeyValuePair <string, string> entry in parameters)
            {
                rep_params += entry.Key.ToString() + "|" + entry.Value + "^";
            }
            if (rep_params.Length > 0)
            {
                if (rep_params[rep_params.Length - 1] == '^')
                {
                    rep_params = rep_params.Remove(rep_params.Length - 1);
                }
            }



            ReportGenericRequest req = new ReportGenericRequest();

            req.paramString = rep_params;


            ListResponse <EmployeePenaltyApproval> response = _employeeService.ChildGetAll <EmployeePenaltyApproval>(req);

            if (!response.Success)
            {
                Common.errorMessage(response);
                return;
            }
            response.Items.ForEach(x =>
            {
                switch (x.status)
                {
                case 1:
                    x.statusString = StatusNew.Text;
                    break;

                case 2:
                    x.statusString = StatusApproved.Text;
                    ;
                    break;

                case -1:
                    x.statusString = StatusRejected.Text;

                    break;
                }
            }
                                   );
            ApprovalStore.DataSource = response.Items;
            ApprovalStore.DataBind();
        }
コード例 #12
0
        protected void PoPuP(object sender, DirectEventArgs e)
        {
            int    id   = Convert.ToInt32(e.ExtraParams["id"]);
            string type = e.ExtraParams["type"];

            CurrentpenaltyId.Text = id.ToString();
            FillPenalty();
            panelRecordDetails.ActiveIndex = 0;
            switch (type)
            {
            case "imgEdit":
                //Step 1 : get the object from the Web Service
                RecordRequest r = new RecordRequest();
                r.RecordID = id.ToString();
                RecordResponse <EmployeePenalty> response = _employeeService.ChildGetRecord <EmployeePenalty>(r);
                if (!response.Success)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    Common.errorMessage(response);
                    return;
                }
                //Step 2 : call setvalues with the retrieved object
                this.BasicInfoTab.SetValues(response.result);
                employeeId.GetStore().Add(new object[]
                {
                    new
                    {
                        recordId = response.result.employeeId,
                        fullName = response.result.employeeName
                    }
                });
                employeeId.SetValue(response.result.employeeId);

                this.EditRecordWindow.Title = Resources.Common.EditWindowsTitle;
                this.EditRecordWindow.Show();
                break;

            case "imgDelete":
                X.Msg.Confirm(Resources.Common.Confirmation, Resources.Common.DeleteOneRecord, new MessageBoxButtonsConfig
                {
                    Yes = new MessageBoxButtonConfig
                    {
                        //We are call a direct request metho for deleting a record
                        Handler = String.Format("App.direct.DeleteRecord({0})", id),
                        Text    = Resources.Common.Yes
                    },
                    No = new MessageBoxButtonConfig
                    {
                        Text = Resources.Common.No
                    }
                }).Show();
                break;

            case "colAttach":

                //Here will show up a winow relatice to attachement depending on the case we are working on
                break;

            default:
                break;
            }
        }
コード例 #13
0
        protected void SaveGroupUsers(object sender, DirectEventArgs e)
        {
            try
            {
                //Getting the id to check if it is an Add or an edit as they are managed within the same form.
                string id       = e.ExtraParams["id"];
                string selected = e.ExtraParams["selectedGroups"];
                List <SecurityGroupUser> selectedUsers = JsonConvert.DeserializeObject <List <SecurityGroupUser> >(selected);

                selectedUsers.ForEach(x => x.userId = CurrentUser.Text);



                GroupUsersListRequest request = new GroupUsersListRequest();
                request.UserId = CurrentUser.Text;
                ListResponse <SecurityGroupUser> userGroups = _accessControlService.ChildGetAll <SecurityGroupUser>(request);
                if (!userGroups.Success)
                {
                    Common.errorMessage(userGroups);
                    return;
                }

                PostRequest <SecurityGroupUser>  req  = new PostRequest <SecurityGroupUser>();
                PostResponse <SecurityGroupUser> resp = new PostResponse <SecurityGroupUser>();
                userGroups.Items.ForEach(x =>
                {
                    req.entity = x;
                    resp       = _accessControlService.ChildDelete <SecurityGroupUser>(req);
                    if (!resp.Success)
                    {
                        Common.errorMessage(resp);
                        throw new Exception();
                    }
                });


                //req.entity = new SecurityGroupUser() { sgId = "0", userId = CurrentUser.Text };
                //resp = _accessControlService.ChildDelete<SecurityGroupUser>(req);


                foreach (var item in selectedUsers)
                {
                    req.entity        = item;
                    req.entity.userId = CurrentUser.Text;
                    resp = _accessControlService.ChildAddOrUpdate <SecurityGroupUser>(req);
                    if (!resp.Success)
                    {
                        Common.errorMessage(resp);
                        throw new Exception();
                    }
                }
                Notification.Show(new NotificationConfig
                {
                    Title = Resources.Common.Notification,
                    Icon  = Icon.Information,
                    Html  = Resources.Common.RecordSavingSucc
                });
                groupUsersWindow.Close();
                UserGroupsStore.Reload();
            }
            catch (Exception exp)
            {
                X.MessageBox.Alert(GetGlobalResourceObject("Common", "Error").ToString(), exp.Message);
            }
        }
コード例 #14
0
        protected void SaveNewRecord(object sender, DirectEventArgs e)
        {
            //Getting the id to check if it is an Add or an edit as they are managed within the same form.
            string id = e.ExtraParams["id"];

            string   obj = e.ExtraParams["values"];
            UserInfo b   = JsonConvert.DeserializeObject <UserInfo>(obj);

            b.activeStatus = isInactiveCheck.Checked ?Convert.ToInt16(ActiveStatus.INACTIVE) : Convert.ToInt16(ActiveStatus.ACTIVE);

            b.recordId = id;
            // Define the object to add or edit as null
            if (employeeId.SelectedItem != null && employeeId.SelectedItem.Value != null)
            {
                b.employeeId = employeeId.SelectedItem.Value;
                b.fullName   = employeeId.SelectedItem.Text;
            }

            if (string.IsNullOrEmpty(CurrentUser.Text))
            {
                try
                {
                    //New Mode
                    //Step 1 : Fill The object and insert in the store
                    PostRequest <UserInfo> request = new PostRequest <UserInfo>();
                    b.password     = EncryptionHelper.encrypt(b.password);
                    request.entity = b;
                    PostResponse <UserInfo> r = _systemService.ChildAddOrUpdate <UserInfo>(request);

                    if (!r.Success)
                    //check if the insert failed
                    {
                        //Show an error saving...
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        Common.errorMessage(r);
                        return;
                    }
                    b.recordId = r.recordId;
                    //elias
                    AccountRecoveryRequest req = new AccountRecoveryRequest();
                    req.Email = b.email;
                    //PasswordRecoveryResponse response = _systemService.RequestPasswordRecovery(req);
                    //if (!response.Success)

                    //{
                    //    //Show an error saving...
                    //    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    //     Common.errorMessage(response);
                    //    return;
                    //}
                    //else
                    //{

                    //Add this record to the store
                    Store1.Reload();
                    CurrentUser.Text    = r.recordId;
                    userGroups.Disabled = false;
                    //Display successful notification
                    Notification.Show(new NotificationConfig
                    {
                        Title = Resources.Common.Notification,
                        Icon  = Icon.Information,
                        Html  = Resources.Common.RecordSavingSucc
                    });

                    //this.EditRecordWindow.Close();
                    //RowSelectionModel sm = this.GridPanel1.GetSelectionModel() as RowSelectionModel;
                    //sm.DeselectAll();
                    //sm.Select(b.recordId.ToString());
                }
                catch (Exception ex)
                {
                    //Error exception displaying a messsage box
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorSavingRecord).Show();
                }
            }
            else
            {
                //Update Mode

                try
                {
                    int index = Convert.ToInt32(id);//getting the id of the record
                    PostRequest <UserInfo> request = new PostRequest <UserInfo>();



                    request.entity = b;
                    PostResponse <UserInfo> r = _systemService.ChildAddOrUpdate <UserInfo>(request);                   //Step 1 Selecting the object or building up the object for update purpose

                    //Step 2 : saving to store

                    //Step 3 :  Check if request fails
                    if (!r.Success)//it maybe another check
                    {
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        Common.errorMessage(r);
                        return;
                    }
                    else
                    {
                        Store1.Reload();
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordUpdatedSucc
                        });
                        this.EditRecordWindow.Close();
                    }
                }
                catch (Exception ex)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
                }
            }
        }
コード例 #15
0
        protected void SaveNewScheduleBenefitRecord(object sender, DirectEventArgs e)
        {
            //Getting the id to check if it is an Add or an edit as they are managed within the same form.


            string           obj = e.ExtraParams["values"];
            ScheduleBenefits b   = JsonConvert.DeserializeObject <ScheduleBenefits>(obj);
            //if (!b.isChecked)
            //{
            //    DeleteScheduleBenefitRecord(b.benefitId.ToString(), bsId.Text);
            //    this.ScheduleBenefitWindow.Close();
            //    return;
            //}


            string id = e.ExtraParams["id"];

            // Define the object to add or edit as null

            //if (string.IsNullOrEmpty(b.benefitId.ToString()))
            //{

            try
            {
                //New Mode
                //Step 1 : Fill The object and insert in the store
                PostRequest <ScheduleBenefits> request = new PostRequest <ScheduleBenefits>();

                request.entity      = b;
                request.entity.bsId = Convert.ToInt32(bsId.Text);
                PostResponse <ScheduleBenefits> r = _benefitsService.ChildAddOrUpdate <ScheduleBenefits>(request);


                //check if the insert failed
                if (!r.Success)    //it maybe be another condition
                {
                    //Show an error saving...
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    Common.errorMessage(r);
                    return;
                }
                else
                {
                    //Add this record to the store
                    ScheduleBenefitsStore.Reload();

                    //Display successful notification
                    Notification.Show(new NotificationConfig
                    {
                        Title = Resources.Common.Notification,
                        Icon  = Icon.Information,
                        Html  = Resources.Common.RecordSavingSucc
                    });

                    this.ScheduleBenefitWindow.Close();
                    //RowSelectionModel sm = this.GridPanel1.GetSelectionModel() as RowSelectionModel;
                    //sm.DeselectAll();
                    //sm.Select(b.recordId.ToString());
                }
            }
            catch (Exception ex)
            {
                //Error exception displaying a messsage box
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorSavingRecord).Show();
            }



            //else
            //{
            //    //Update Mode

            //    try
            //    {
            //        //getting the id of the record
            //        PostRequest<BenefitsSchedule> request = new PostRequest<BenefitsSchedule>();
            //        request.entity = b;
            //        PostResponse<BenefitsSchedule> r = _benefitsService.ChildAddOrUpdate<BenefitsSchedule>(request);                      //Step 1 Selecting the object or building up the object for update purpose

            //        //Step 2 : saving to store

            //        //Step 3 :  Check if request fails
            //        if (!r.Success)//it maybe another check
            //        {
            //            X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
            //          Common.errorMessage(r);
            //            return;
            //        }
            //        else
            //        {


            //            ModelProxy record = this.Store1.GetById(id);
            //            BasicInfoTab.UpdateRecord(record);
            //            record.Commit();
            //            Notification.Show(new NotificationConfig
            //            {
            //                Title = Resources.Common.Notification,
            //                Icon = Icon.Information,
            //                Html = Resources.Common.RecordUpdatedSucc
            //            });
            //            this.EditRecordWindow.Close();


            //        }

            //    }
            //    catch (Exception ex)
            //    {
            //        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
            //        X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
            //    }
            //}
        }
コード例 #16
0
ファイル: Geofences.aspx.cs プロジェクト: EliasTous/ERP
        protected void SaveNewRecord(object sender, DirectEventArgs e)
        {
            //Getting the id to check if it is an Add or an edit as they are managed within the same form.


            string obj = e.ExtraParams["values"];
            JsonSerializerSettings s = new JsonSerializerSettings();

            s.NullValueHandling = NullValueHandling.Ignore;
            Geofence b = JsonConvert.DeserializeObject <Geofence>(obj, s);

            if (branchId.SelectedItem != null)
            {
                b.branchName = branchId.SelectedItem.Text;
            }

            string id = e.ExtraParams["id"];

            b.shape = (short)(e.ExtraParams["isCircle"] == "true"?1:0);
            b.lat   = Convert.ToDouble(e.ExtraParams["lat1"]);
            b.lon   = Convert.ToDouble(e.ExtraParams["lon1"]);
            if (b.shape == 1)
            {
                b.radius = Convert.ToDouble(e.ExtraParams["radius"]);
                b.lat2   = 0;
                b.lon2   = 0;
            }
            else
            {
                b.lat2   = Convert.ToDouble(e.ExtraParams["lat2"]);
                b.lon2   = Convert.ToDouble(e.ExtraParams["lon2"]);
                b.radius = 0;
            }

            // Define the object to add or edit as null

            if (string.IsNullOrEmpty(id))
            {
                try
                {
                    //New Mode
                    //Step 1 : Fill The object and insert in the store
                    PostRequest <Geofence> request = new PostRequest <Geofence>();

                    request.entity = b;
                    PostResponse <Geofence> r = _timeAttendanceService.ChildAddOrUpdate <Geofence>(request);


                    //check if the insert failed
                    if (!r.Success)//it maybe be another condition
                    {
                        //Show an error saving...
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        Common.errorMessage(r);
                        return;
                    }
                    else
                    {
                        b.recordId = r.recordId;
                        //Add this record to the store
                        this.Store1.Insert(0, b);

                        //Display successful notification
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordSavingSucc
                        });

                        this.EditRecordWindow.Close();
                        RowSelectionModel sm = this.GridPanel1.GetSelectionModel() as RowSelectionModel;
                        sm.DeselectAll();
                        sm.Select(b.recordId.ToString());
                    }
                }
                catch (Exception ex)
                {
                    //Error exception displaying a messsage box
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorSavingRecord).Show();
                }
            }
            else
            {
                //Update Mode

                try
                {
                    //getting the id of the record
                    PostRequest <Geofence> request = new PostRequest <Geofence>();
                    request.entity = b;
                    PostResponse <Geofence> r = _timeAttendanceService.ChildAddOrUpdate <Geofence>(request);                      //Step 1 Selecting the object or building up the object for update purpose

                    //Step 2 : saving to store

                    //Step 3 :  Check if request fails
                    if (!r.Success)//it maybe another check
                    {
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
                        return;
                    }
                    else
                    {
                        ModelProxy record = this.Store1.GetById(id);
                        BasicInfoTab.UpdateRecord(record);
                        record.Set("branchName", b.branchName);
                        record.Commit();
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordUpdatedSucc
                        });
                        this.EditRecordWindow.Close();
                    }
                }
                catch (Exception ex)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
                }
            }
        }
コード例 #17
0
        protected void SaveNewReportRecord(object sender, DirectEventArgs e)
        {
            //Getting the id to check if it is an Add or an edit as they are managed within the same form.


            string obj = e.ExtraParams["values"];
            Report b   = new Report();// JsonConvert.DeserializeObject<Report>(obj);

            string id = e.ExtraParams["id"];

            b.reportId   = Convert.ToInt32(classId.SelectedItem.Value);
            b.parameters = parameters.Text;
            // Define the object to add or edit as null

            if (string.IsNullOrEmpty(id))
            {
                try
                {
                    //New Mode
                    //Step 1 : Fill The object and insert in the store
                    PostRequest <Report> request = new PostRequest <Report>();

                    request.entity        = b;
                    request.entity.taskId = Convert.ToInt32(currentRuId.Text);
                    //request.entity.value = string.IsNullOrEmpty(request.entity.value) ? null : request.entity.value;
                    //request.entity.expressionId = expressionCombo2.getExpression();
                    PostResponse <Report> r = _taskScheduleService.ChildAddOrUpdate <Report>(request);


                    //check if the insert failed
                    if (!r.Success)//it maybe be another condition
                    {
                        //Show an error saving...
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        Common.errorMessage(r);
                        return;
                    }
                    else
                    {
                        //b.recordId = r.recordId;
                        //Add this record to the store
                        FillReportStore();

                        this.reportsWindow.Close();
                        //Display successful notification
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordSavingSucc
                        });
                    }
                }
                catch (Exception ex)
                {
                    //Error exception displaying a messsage box
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorSavingRecord).Show();
                }
            }
            else
            {
                //Update Mode

                try
                {
                    //getting the id of the record
                    PostRequest <Report> request = new PostRequest <Report>();
                    request.entity        = b;
                    request.entity.taskId = Convert.ToInt32(currentRuId.Text);
                    //request.entity.value = string.IsNullOrEmpty(request.entity.value) ? null : request.entity.value;
                    PostResponse <Report> r = _taskScheduleService.ChildAddOrUpdate <Report>(request);                      //Step 1 Selecting the object or building up the object for update purpose

                    //Step 2 : saving to store

                    //Step 3 :  Check if request fails
                    if (!r.Success)//it maybe another check
                    {
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        Common.errorMessage(r);
                        return;
                    }
                    else
                    {
                        FillReportStore();
                        this.reportsWindow.Close();
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordUpdatedSucc
                        });
                    }
                }
                catch (Exception ex)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
                }
            }
        }
コード例 #18
0
        /// <summary>
        /// Adding new record
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>



        protected void Store1_RefreshData(object sender, StoreReadDataEventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(_systemService.SessionHelper.GetEmployeeId()))
                {
                    return;
                }

                string rep_params = "";
                Dictionary <string, string> parameters = new Dictionary <string, string>();



                //  parameters.Add("1", "1");
                if (!string.IsNullOrEmpty(Request.QueryString["_employeeId"]) && !string.IsNullOrEmpty(Request.QueryString["_fromDayId"]) && !string.IsNullOrEmpty(Request.QueryString["_toDayId"]))
                {
                    parameters.Add("2", Request.QueryString["_fromDayId"]);
                    parameters.Add("3", Request.QueryString["_toDayId"]);
                    parameters.Add("1", Request.QueryString["_employeeId"]);
                }
                else
                {
                    parameters.Add("1", _systemService.SessionHelper.GetEmployeeId());
                    parameters.Add("2", dateRange1.GetRange().DateFrom.ToString("yyyyMMdd"));
                    parameters.Add("3", dateRange1.GetRange().DateTo.ToString("yyyyMMdd"));
                    if (!string.IsNullOrEmpty(apStatus.Value.ToString()))
                    {
                        parameters.Add("5", apStatus.Value.ToString());
                    }


                    if (!string.IsNullOrEmpty(timeVariationType.Value.ToString()))
                    {
                        parameters.Add("4", timeVariationType.Value.ToString());
                    }
                }



                foreach (KeyValuePair <string, string> entry in parameters)
                {
                    rep_params += entry.Key.ToString() + "|" + entry.Value + "^";
                }
                if (rep_params.Length > 0)
                {
                    if (rep_params[rep_params.Length - 1] == '^')
                    {
                        rep_params = rep_params.Remove(rep_params.Length - 1);
                    }
                }

                ReportGenericRequest req = new ReportGenericRequest();
                req.paramString = rep_params;



                ListResponse <TimeVariationSelfService> daysResponse = _selfServiceService.ChildGetAll <TimeVariationSelfService>(req);

                //ActiveAttendanceRequest r = GetActiveAttendanceRequest();

                //ListResponse<ActiveAbsence> daysResponse = _timeAttendanceService.ChildGetAll<ActiveAbsence>(r);
                if (!daysResponse.Success)
                {
                    Common.errorMessage(daysResponse);
                    return;
                }
                bool rtl = _systemService.SessionHelper.CheckIfArabicSession();
                List <XMLDictionary> timeCodeList = ConstTimeVariationType.TimeCodeList(_systemService);

                daysResponse.Items.ForEach(
                    x =>
                {
                    x.clockDurationString = time(x.clockDuration, true);
                    x.durationString      = time(x.duration, true);

                    x.timeCodeString = timeCodeList.Where(y => y.key == Convert.ToInt16(x.timeCode)).Count() != 0 ? timeCodeList.Where(y => y.key == Convert.ToInt32(x.timeCode)).First().value : string.Empty;

                    x.apStatusString    = FillApprovalStatus(x.apStatus);
                    x.damageLevelString = FillDamageLevelString(x.damageLevel);
                    if (rtl)
                    {
                        x.dayIdString = DateTime.ParseExact(x.dayId, "yyyyMMdd", new CultureInfo("en")).ToString("dddd  dd MMMM yyyy ", new System.Globalization.CultureInfo("ar-AE"));
                    }
                    else
                    {
                        x.dayIdString = DateTime.ParseExact(x.dayId, "yyyyMMdd", new CultureInfo("en")).ToString("dddd  dd MMMM yyyy ", new System.Globalization.CultureInfo("en-US"));
                    }
                }
                    );
                Store1.DataSource = daysResponse.Items;
                Store1.DataBind();
                e.Total     = daysResponse.count;
                format.Text = _systemService.SessionHelper.GetDateformat().ToUpper();
            }
            catch (Exception exp)
            {
                X.Msg.Alert(Resources.Common.Error, exp.Message).Show();
            }
        }
コード例 #19
0
        protected void SaveNewRecord(object sender, DirectEventArgs e)
        {
            //Getting the id to check if it is an Add or an edit as they are managed within the same form.


            string obj = e.ExtraParams["values"];
            DashBoardTimeVariation b = JsonConvert.DeserializeObject <DashBoardTimeVariation>(obj);



            string id = e.ExtraParams["id"];

            // Define the object to add or edit as null



            try
            {
                //getting the id of the record
                TimeVariationListRequest req = new TimeVariationListRequest();

                ListResponse <DashBoardTimeVariation> r = _timeAttendanceService.ChildGetAll <DashBoardTimeVariation>(req);                    //Step 1 Selecting the object or building up the object for update purpose

                //Step 2 : saving to store

                //Step 3 :  Check if request fails
                if (!r.Success)//it maybe another check
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    Common.errorMessage(r);;
                    return;
                }
                else
                {
                    if (r.Items.Where(x => x.primaryKey == id).Count() == 0)
                    {
                        return;
                    }
                    else
                    {
                        PostRequest <DashBoardTimeVariation> request = new PostRequest <DashBoardTimeVariation>();
                        request.entity             = r.Items.Where(x => x.primaryKey == id).First();
                        request.entity.damageLevel = Convert.ToInt16(damage.Value);
                        request.entity.duration    = Convert.ToInt16(duration.Text);
                        PostResponse <DashBoardTimeVariation> response = _timeAttendanceService.ChildAddOrUpdate <DashBoardTimeVariation>(request);
                        if (!response.Success)//it maybe another check
                        {
                            X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                            Common.errorMessage(response);
                            return;
                        }
                    }
                }


                Store1.Reload();
                Notification.Show(new NotificationConfig
                {
                    Title = Resources.Common.Notification,
                    Icon  = Icon.Information,
                    Html  = Resources.Common.RecordUpdatedSucc
                });
                this.EditRecordWindow.Close();
            }


            catch (Exception ex)
            {
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
            }
        }
コード例 #20
0
        protected void SaveNewRecord(object sender, DirectEventArgs e)
        {
            //Getting the id to check if it is an Add or an edit as they are managed within the same form.


            string obj = e.ExtraParams["values"];
            DashBoardTimeVariation b = JsonConvert.DeserializeObject <DashBoardTimeVariation>(obj);



            string id = e.ExtraParams["id"];

            // Define the object to add or edit as null



            try
            {
                //getting the id of the record
                TimeVariationListRequest req1 = GetAbsentRequest();

                string rep_params = "";
                Dictionary <string, string> parameters = new Dictionary <string, string>();
                parameters.Add("1", req1.employeeId);
                parameters.Add("2", req1.fromDayId.ToString("yyyyMMdd"));
                parameters.Add("3", req1.toDayId.ToString("yyyyMMdd"));
                parameters.Add("4", "0");
                parameters.Add("5", req1.timeCode);
                parameters.Add("6", req1.apStatus);
                parameters.Add("7", req1.BranchId);
                parameters.Add("8", req1.DepartmentId);
                parameters.Add("9", req1.EsId);
                foreach (KeyValuePair <string, string> entry in parameters)
                {
                    rep_params += entry.Key.ToString() + "|" + entry.Value + "^";
                }
                if (rep_params.Length > 0)
                {
                    if (rep_params[rep_params.Length - 1] == '^')
                    {
                        rep_params = rep_params.Remove(rep_params.Length - 1);
                    }
                }



                ReportGenericRequest req = new ReportGenericRequest();
                req.paramString = rep_params;



                ListResponse <DashBoardTimeVariation> r = _selfServiceService.ChildGetAll <DashBoardTimeVariation>(req);                   //Step 1 Selecting the object or building up the object for update purpose

                //Step 2 : saving to store

                //Step 3 :  Check if request fails
                if (!r.Success)//it maybe another check
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    Common.errorMessage(r);;
                    return;
                }
                else
                {
                    if (r.Items.Where(x => x.recordId == id).Count() == 0)
                    {
                        return;
                    }
                    else
                    {
                        PostRequest <DashBoardTimeVariation> request = new PostRequest <DashBoardTimeVariation>();
                        request.entity               = r.Items.Where(x => x.recordId == id).First();
                        request.entity.damageLevel   = Convert.ToInt16(damage.Value);
                        request.entity.duration      = Convert.ToInt16(duration.Text);
                        request.entity.justification = b.justification;
                        // request.entity.recordId = null;
                        PostResponse <DashBoardTimeVariation> response = _selfServiceService.ChildAddOrUpdate <DashBoardTimeVariation>(request);
                        if (!response.Success)//it maybe another check
                        {
                            X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                            Common.errorMessage(response);
                            return;
                        }
                    }
                }


                Store1.Reload();
                Notification.Show(new NotificationConfig
                {
                    Title = Resources.Common.Notification,
                    Icon  = Icon.Information,
                    Html  = Resources.Common.RecordUpdatedSucc
                });
                this.EditRecordWindow.Close();
            }


            catch (Exception ex)
            {
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
            }
        }
コード例 #21
0
        protected void PoPuP(object sender, DirectEventArgs e)
        {
            try {
                BasicInfoTab.Reset();
                FillDamageStore();
                string id                 = e.ExtraParams["id"];
                int    dayId              = Convert.ToInt32(e.ExtraParams["dayId"]);
                int    employeeId         = Convert.ToInt32(e.ExtraParams["employeeId"]);
                string damageLavel        = e.ExtraParams["damage"];
                string durationValue      = e.ExtraParams["duration"];
                string timeCodeParameter  = e.ExtraParams["timeCode"];
                string shiftId            = e.ExtraParams["shiftId"];
                string apStatus           = e.ExtraParams["apStatus"];
                string type               = e.ExtraParams["type"];
                string justificationParam = e.ExtraParams["justification"];
                string clockDuration      = e.ExtraParams["clockDuration"];
                string arId               = e.ExtraParams["arId"];


                switch (type)
                {
                case "imgEdit":
                    //Step 1 : get the object from the Web Service

                    //Step 2 : call setvalues with the retrieved object

                    damage.Select(damageLavel);
                    duration.Text = durationValue;
                    clock.Text    = clockDuration;
                    // recordId.Text = id;
                    justification.Text = justificationParam;
                    TimeApprovalReasonControl.setApprovalReason(arId);
                    if (apStatus == "2" || apStatus == "-1")
                    {
                        disableEditing(false);
                    }
                    else
                    {
                        disableEditing(true);
                    }

                    recordId.Text = id;
                    this.EditRecordWindow.Title = Resources.Common.EditWindowsTitle;
                    this.EditRecordWindow.Show();
                    break;

                case "imgDelete":
                    X.Msg.Confirm(Resources.Common.Confirmation, Resources.Common.DeleteOneRecord, new MessageBoxButtonsConfig
                    {
                        Yes = new MessageBoxButtonConfig
                        {
                            //We are call a direct request metho for deleting a record
                            Handler = String.Format("App.direct.DeleteRecord({0})", id),
                            Text    = Resources.Common.Yes
                        },
                        No = new MessageBoxButtonConfig
                        {
                            Text = Resources.Common.No
                        }
                    }).Show();
                    break;



                case "imgReject":
                    X.Msg.Confirm(Resources.Common.Confirmation, GetLocalResourceObject("RejectRecord").ToString(), new MessageBoxButtonsConfig
                    {
                        Yes = new MessageBoxButtonConfig
                        {
                            //We are call a direct request metho for deleting a record
                            Handler = String.Format("App.direct.RejectRecord({0})", id),
                            Text    = Resources.Common.Yes
                        },
                        No = new MessageBoxButtonConfig
                        {
                            Text = Resources.Common.No
                        }
                    }).Show();
                    break;

                case "imgAttach":
                    overrideForm.Reset();
                    RecordRequest req = new RecordRequest();
                    //req.employeeId = employeeId.ToString();
                    //req.dayId = dayId.ToString();
                    //req.shiftId = shiftId;
                    //req.timeCode = timeCodeParameter;
                    req.RecordID = id;
                    RecordResponse <DashBoardTimeVariation> resp = _timeAttendanceService.ChildGetRecord <DashBoardTimeVariation>(req);
                    if (!resp.Success)
                    {
                        Common.errorMessage(resp);
                        return;
                    }

                    ORId.Text = resp.result.recordId;
                    timeCodeStore.DataSource = ConstTimeVariationType.TimeCodeList(_systemService).Where(x => x.key == Convert.ToInt32(timeCodeParameter)).ToList();
                    timeCodeStore.DataBind();

                    FillBranch();
                    EmployeeQuickViewRecordRequest QVReq = new EmployeeQuickViewRecordRequest();
                    QVReq.RecordID = employeeId.ToString();

                    QVReq.asOfDate = DateTime.Now;
                    RecordResponse <EmployeeQuickView> qv = _employeeService.ChildGetRecord <EmployeeQuickView>(QVReq);

                    if (!qv.Success)
                    {
                        Common.errorMessage(qv);
                        return;
                    }
                    overrideForm.SetValues(resp.result);


                    branchId.Select(qv.result.branchId);

                    ListRequest UdIdReq = new ListRequest();

                    UdIdReq.Filter = "";
                    ListResponse <BiometricDevice> UdIdResp = _timeAttendanceService.ChildGetAll <BiometricDevice>(UdIdReq);
                    if (!UdIdResp.Success)
                    {
                        Common.errorMessage(UdIdResp);
                        return;
                    }
                    udIdStore.DataSource = UdIdResp.Items;
                    udIdStore.DataBind();
                    FlatPunchesListRequest FPreq = new FlatPunchesListRequest();
                    FPreq.shiftId = shiftId;
                    FPreq.sortBy  = "clockStamp";
                    FPreq.StartAt = "0";
                    FPreq.Size    = "30";
                    ListResponse <FlatPunch> FPresp = _timeAttendanceService.ChildGetAll <FlatPunch>(FPreq);

                    if (!FPresp.Success)
                    {
                        Common.errorMessage(FPresp);
                        return;
                    }

                    punchesList.Text = "";
                    FPresp.Items.ForEach(x =>
                    {
                        punchesList.Text += x.clockStamp.ToString(_systemService.SessionHelper.GetDateformat() + " HH:mm", CultureInfo.CurrentUICulture) + System.Environment.NewLine;
                    }


                                         );


                    inOutStore.DataSource = Common.XMLDictionaryList(_systemService, "34");
                    inOutStore.DataBind();
                    overrideWindow.Show();

                    break;

                case "LinkRender":
                    FillTimeApproval(id);
                    TimeApprovalWindow.Show();

                    break;

                case "imgHistory":

                    TimeVariationHistoryControl1.Show("41203", id);
                    break;

                default:
                    break;
                }
            }
            catch (Exception exp)
            {
                X.Msg.Alert(Resources.Common.Error, exp.Message).Show();
            }
        }
コード例 #22
0
ファイル: Departments.aspx.cs プロジェクト: EliasTous/ERP
        protected void PoPuP(object sender, DirectEventArgs e)
        {
            int    id         = Convert.ToInt32(e.ExtraParams["id"]);
            string buttontype = e.ExtraParams["type"];

            CurrentDepartment.Text = id.ToString();

            switch (buttontype)
            {
            case "imgEdit":
                //Step 1 : get the object from the Web Service
                RecordRequest r = new RecordRequest();
                r.RecordID = id.ToString();
                RecordResponse <Department> response = _branchService.ChildGetRecord <Department>(r);
                if (!response.Success)
                {
                    Common.errorMessage(response);
                    return;
                }
                //FillParent();

                //Step 2 : call setvalues with the retrieved object


                if (response.result.supervisorId.HasValue)
                {
                    supervisorId.GetStore().Add(new object[]
                    {
                        new
                        {
                            recordId = response.result.supervisorId,
                            fullName = response.result.managerName
                        }
                    });
                    supervisorId.SetValue(response.result.supervisorId);
                }
                this.BasicInfoTab.SetValues(response.result);
                isInactiveCheck.SetValue(response.result.activeStatus == (Int16)ActiveStatus.ACTIVE ? false : true);
                isInactiveCheck.Checked = response.result.activeStatus == (Int16)ActiveStatus.ACTIVE ? false : true;
                //if (!string.IsNullOrEmpty(response.result.scId))
                //    scId.Select(response.result.scName);
                //if (!string.IsNullOrEmpty(response.result.caId.ToString()))
                //    caId.Select(response.result.caName);
                //if (response.result.type != null)
                //    type.Select(response.result.type);

                // InitCombos(response.result);
                this.EditRecordWindow.Title = Resources.Common.EditWindowsTitle;
                this.EditRecordWindow.Show();
                break;

            case "imgDelete":
                X.Msg.Confirm(Resources.Common.Confirmation, Resources.Common.DeleteOneRecord, new MessageBoxButtonsConfig
                {
                    Yes = new MessageBoxButtonConfig
                    {
                        //We are call a direct request metho for deleting a record
                        Handler = String.Format("App.direct.DeleteRecord({0})", id),
                        Text    = Resources.Common.Yes
                    },
                    No = new MessageBoxButtonConfig
                    {
                        Text = Resources.Common.No
                    }
                }).Show();
                break;

            case "imgAttach":

                //Here will show up a winow relatice to attachement depending on the case we are working on
                break;

            default:
                break;
            }
        }
コード例 #23
0
        protected void SaveNewRecord(object sender, DirectEventArgs e)
        {
            //Getting the id to check if it is an Add or an edit as they are managed within the same form.


            string obj = e.ExtraParams["values"];
            DashBoardTimeVariation b = JsonConvert.DeserializeObject <DashBoardTimeVariation>(obj);



            string id = e.ExtraParams["id"];

            // Define the object to add or edit as null



            try
            {
                //getting the id of the record

                RecordRequest req = new RecordRequest();
                req.RecordID = id;


                RecordResponse <DashBoardTimeVariation> r = _timeAttendanceService.ChildGetRecord <DashBoardTimeVariation>(req);                    //Step 1 Selecting the object or building up the object for update purpose

                if (!r.Success)
                {
                    Common.errorMessage(r);
                    return;
                }
                if (r.result != null)
                {
                    PostRequest <DashBoardTimeVariation> request = new PostRequest <DashBoardTimeVariation>();
                    request.entity               = r.result;
                    request.entity.damageLevel   = Convert.ToInt16(damage.Value);
                    request.entity.duration      = Convert.ToInt16(duration.Text);
                    request.entity.justification = b.justification;
                    request.entity.arId          = TimeApprovalReasonControl.getApprovalReason() == "0"?null: TimeApprovalReasonControl.getApprovalReason();


                    PostResponse <DashBoardTimeVariation> response = _timeAttendanceService.ChildAddOrUpdate <DashBoardTimeVariation>(request);
                    if (!response.Success)    //it maybe another check
                    {
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        Common.errorMessage(response);
                        return;
                    }
                }



                Store1.Reload();
                Notification.Show(new NotificationConfig
                {
                    Title = Resources.Common.Notification,
                    Icon  = Icon.Information,
                    Html  = Resources.Common.RecordUpdatedSucc
                });
                this.EditRecordWindow.Close();
            }


            catch (Exception ex)
            {
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
            }
        }
コード例 #24
0
ファイル: Departments.aspx.cs プロジェクト: EliasTous/ERP
        protected void SaveNewRecord(object sender, DirectEventArgs e)
        {
            //Getting the id to check if it is an Add or an edit as they are managed within the same form.
            string id = e.ExtraParams["id"];

            string obj = e.ExtraParams["values"];

            Department b = JsonConvert.DeserializeObject <Department>(obj);

            b.scName   = scId.SelectedItem.Text;
            b.recordId = id;

            b.caName = caId.SelectedItem.Text;
            // Define the object to add or edit as null
            if (supervisorId.SelectedItem.Text != null)
            {
                b.managerName = supervisorId.SelectedItem.Text;
            }
            if (parentId.SelectedItem != null)
            {
                b.parentName = parentId.SelectedItem.Text;
            }
            if (!b.isInactive.HasValue)
            {
                b.isInactive   = false;
                b.activeStatus = (Int16)ActiveStatus.ACTIVE;
            }
            else
            {
                b.activeStatus = (Int16)ActiveStatus.INACTIVE;
            }
            if (scId.SelectedItem != null)
            {
                b.scId = scId.SelectedItem.Value;
            }

            if (string.IsNullOrEmpty(id))
            {
                try
                {
                    //New Mode
                    //Step 1 : Fill The object and insert in the store
                    PostRequest <Department> request = new PostRequest <Department>();
                    request.entity = b;
                    PostResponse <Department> r = _branchService.ChildAddOrUpdate <Department>(request);
                    b.recordId = r.recordId;

                    //check if the insert failed
                    if (!r.Success)//it maybe be another condition
                    {
                        //Show an error saving...

                        Common.errorMessage(r);;
                        return;
                    }
                    else
                    {
                        //Add this record to the store
                        Store1.Reload();

                        //Display successful notification
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordSavingSucc
                        });

                        this.EditRecordWindow.Close();
                        RowSelectionModel sm = this.GridPanel1.GetSelectionModel() as RowSelectionModel;
                        sm.DeselectAll();
                        sm.Select(b.recordId.ToString());
                    }
                }
                catch (Exception ex)
                {
                    //Error exception displaying a messsage box
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorSavingRecord).Show();
                }
            }
            else
            {
                //Update Mode

                try
                {
                    int index = Convert.ToInt32(id);//getting the id of the record

                    PostRequest <Department> request = new PostRequest <Department>();
                    request.entity = b;
                    PostResponse <Department> r = _branchService.ChildAddOrUpdate <Department>(request);                   //Step 1 Selecting the object or building up the object for update purpose

                    //Step 2 : saving to store

                    //Step 3 :  Check if request fails
                    if (!r.Success)//it maybe another check
                    {
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        Common.errorMessage(r);;
                        return;
                    }
                    else
                    {
                        //ModelProxy record = this.Store1.GetById(index);
                        //BasicInfoTab.UpdateRecord(record);

                        //record.Set("managerName", b.managerName);
                        //record.Set("parentName", b.parentName);
                        //record.Set("caName", b.caName);
                        //record.Set("scName", b.scName);


                        //record.Commit();
                        Store1.Reload();
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordUpdatedSucc
                        });

                        this.EditRecordWindow.Close();
                    }
                }
                catch (Exception ex)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
                }
            }
            departmentStore.Reload();
        }
コード例 #25
0
ファイル: WorkFlows.aspx.cs プロジェクト: EliasTous/ERP
        protected void PoPuPWS(object sender, DirectEventArgs e)
        {
            string branchIdParameter     = e.ExtraParams["branchId"];
            string departmentIdParameter = e.ExtraParams["departmentId"];
            string seqNo = e.ExtraParams["seqNo"];
            string approverPositionParameter = e.ExtraParams["approverPosition"];
            string type = e.ExtraParams["type"];



            switch (type)
            {
            case "imgEdit":
                //Step 1 : get the object from the Web Service

                //Step 2 : call setvalues with the retrieved object

                WorkSequenceRecordRequest r = new WorkSequenceRecordRequest();
                r.seqNo = seqNo;
                r.wfId  = currentWorkFlowId.Text;

                RecordResponse <WorkSequence> response = _companyStructureRepository.ChildGetRecord <WorkSequence>(r);
                if (!response.Success)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    Common.errorMessage(response);
                    return;
                }
                //Step 2 : call setvalues with the retrieved object
                this.WSForm.SetValues(response.result);

                seqNO.Text = seqNo;

                //branchId.Select(branchIdParameter);
                //branchId.SetValue(branchIdParameter);
                //departmentId.Select(departmentIdParameter);
                //departmentId.SetValue(departmentIdParameter);
                //approverPosition.Select(approverPositionParameter);
                //approverPosition.SetValue(approverPositionParameter);



                this.EditWSWindow.Title = Resources.Common.EditWindowsTitle;
                this.EditWSWindow.Show();
                break;



            case "imgDelete":
                X.Msg.Confirm(Resources.Common.Confirmation, Resources.Common.DeleteOneRecord, new MessageBoxButtonsConfig
                {
                    Yes = new MessageBoxButtonConfig
                    {
                        //We are call a direct request metho for deleting a record
                        Handler = String.Format("App.direct.DeleteWSRecord({0})", Convert.ToInt32(seqNo)),
                        Text    = Resources.Common.Yes
                    },
                    No = new MessageBoxButtonConfig
                    {
                        Text = Resources.Common.No
                    }
                }).Show();
                break;


                Notification.Show(new NotificationConfig
                {
                    Title = Resources.Common.Notification,
                    Icon  = Icon.Information,
                    Html  = Resources.Common.RecordUpdatedSucc
                });



                break;

            case "imgAttach":

                //Here will show up a winow relatice to attachement depending on the case we are working on
                break;

            default:
                break;
            }
        }
コード例 #26
0
        protected void SaveNewFUNConstRecord(object sender, DirectEventArgs e)
        {
            //Getting the id to check if it is an Add or an edit as they are managed within the same form.
            string id         = CurrentFunctionId.Text; //e.ExtraParams["expressionId"];
            string functionId = e.ExtraParams["functionId"];
            string constant   = e.ExtraParams["constant"];

            string          obj = e.ExtraParams["values"];
            PayrollFunConst b   = JsonConvert.DeserializeObject <PayrollFunConst>(obj);

            b.functionId = id;
            // Define the object to add or edit as null

            //if (string.IsNullOrEmpty(id))
            //{

            try
            {
                //New Mode
                //Step 1 : Fill The object and insert in the store
                PostRequest <PayrollFunConst> request = new PostRequest <PayrollFunConst>();
                request.entity            = new PayrollFunConst();
                request.entity.functionId = id;
                request.entity.constant   = constant;
                PostResponse <PayrollFunConst> r = _payrollService.ChildAddOrUpdate <PayrollFunConst>(request);
                b.recordId = r.recordId;

                //check if the insert failed
                if (!r.Success)//it maybe be another condition
                {
                    //Show an error saving...

                    Common.errorMessage(r);
                    return;
                }
                else
                {
                    //Add this record to the store
                    //this.ClientAddressStore.Insert(0, b);

                    //Display successful notification
                    Notification.Show(new NotificationConfig
                    {
                        Title = Resources.Common.Notification,
                        Icon  = Icon.Information,
                        Html  = Resources.Common.RecordSavingSucc
                    });
                    FunctionConstStore.Reload();


                    this.EditFUNConstWindow.Close();
                    //RowSelectionModel sm = this.ClientGridPanel.GetSelectionModel() as RowSelectionModel;
                    //sm.DeselectAll();
                    //sm.Select(b.recordId.ToString());
                }
            }
            catch (Exception ex)
            {
                //Error exception displaying a messsage box
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorSavingRecord).Show();
            }


            //}
            //else
            //{
            //    //Update Mode

            //    try
            //    {
            //        PostRequest<ClientAddress> request = new PostRequest<ClientAddress>();
            //        request.entity = new ClientAddress();
            //        request.entity.address = b;
            //        request.entity.clientId = CurrentClientId.Text;
            //        request.entity.addressId = id;
            //        PostResponse<ClientAddress> r = _saleService.ChildAddOrUpdate<ClientAddress>(request);
            //        b.recordId = r.recordId;

            //        //Step 2 : saving to store

            //        //Step 3 :  Check if request fails
            //        if (!r.Success)//it maybe another check
            //        {
            //            Common.errorMessage(r);
            //            return;
            //        }
            //        else
            //        {


            //            //ModelProxy record = this.ClientStore.GetById(index);
            //            //BasicInfoTab.UpdateRecord(record);
            //            //record.Commit();

            //            ClientAddressStore.Reload();


            //            Notification.Show(new NotificationConfig
            //            {
            //                Title = Resources.Common.Notification,
            //                Icon = Icon.Information,
            //                Html = Resources.Common.RecordUpdatedSucc
            //            });
            //            this.EditAddressWindow.Close();


            //        }

            //    }
            //    catch (Exception ex)
            //    {
            //        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
            //        X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
            //    }
            //}
        }
コード例 #27
0
ファイル: TimeCodes.aspx.cs プロジェクト: EliasTous/ERP
        protected void PoPuP(object sender, DirectEventArgs e)
        {
            try {
                string type         = e.ExtraParams["type"];
                string edTypeP      = e.ExtraParams["edType"];
                string timeCodeP    = e.ExtraParams["timeCode"];
                string edIdP        = e.ExtraParams["edId"];
                string apIdP        = e.ExtraParams["apId"];
                string gracePeriodP = e.ExtraParams["gracePeriod"];
                currentEDtype.Text = edTypeP;
                switch (type)
                {
                case "imgEdit":
                    //Step 1 : get the object from the Web Service

                    //Step 2 : call setvalues with the retrieved object

                    TimeCodeRecordRequest r = new TimeCodeRecordRequest();
                    r.timeCode = timeCodeP;
                    RecordResponse <TimeCode> response = _payrollService.ChildGetRecord <TimeCode>(r);
                    if (!response.Success)
                    {
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        Common.errorMessage(response);
                        return;
                    }
                    FillApprovalStory();
                    FillensStore();
                    timeCodeStore.DataSource = Common.XMLDictionaryList(_systemService, "3");
                    timeCodeStore.DataBind();
                    this.BasicInfoTab.Reset();
                    //Step 2 : call setvalues with the retrieved object
                    this.BasicInfoTab.SetValues(response.result);
                    if (!String.IsNullOrEmpty(timeCodeP))
                    {
                        timecode.Select(timeCodeP);
                    }
                    this.EditRecordWindow.Title = Resources.Common.EditWindowsTitle;
                    this.EditRecordWindow.Show();
                    break;

                case "imgDelete":
                    X.Msg.Confirm(Resources.Common.Confirmation, Resources.Common.DeleteOneRecord, new MessageBoxButtonsConfig
                    {
                        Yes = new MessageBoxButtonConfig
                        {
                            //We are call a direct request metho for deleting a record
                            // Handler = String.Format("App.direct.DeleteRecord({0})", ),
                            Text = Resources.Common.Yes
                        },
                        No = new MessageBoxButtonConfig
                        {
                            Text = Resources.Common.No
                        }
                    }).Show();
                    break;

                case "imgAttach":

                    //Here will show up a winow relatice to attachement depending on the case we are working on
                    break;

                default:
                    break;
                }
            }
            catch (Exception exp)
            {
                X.Msg.Alert(Resources.Common.Error, exp.Message).Show();
            }
        }
コード例 #28
0
        protected void PoPuPBESC(object sender, DirectEventArgs e)
        {
            string benId = e.ExtraParams["benefitId"];
            string type  = e.ExtraParams["type"];

            switch (type)
            {
            case "imgEdit":
                //Step 1 : get the object from the Web Service

                ScheduleBenefitsRecordRequest r = new ScheduleBenefitsRecordRequest();
                r.bsId      = bsId.Text;
                r.benefitId = benId;

                RecordResponse <ScheduleBenefits> response = _benefitsService.ChildGetRecord <ScheduleBenefits>(r);
                if (!response.Success)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    Common.errorMessage(response);
                    return;
                }
                //Step 2 : call setvalues with the retrieved object
                this.ScheduleBenefitFormPanel.Reset();
                this.ScheduleBenefitFormPanel.SetValues(response.result);

                benefitId.Select(response.result.benefitId.ToString());


                //if (!string.IsNullOrEmpty(response.result.aqType.ToString()))
                //    aqType.Select(response.result.aqType.ToString());
                if (string.IsNullOrEmpty(response.result.defaultAmount.ToString()))
                {
                    defaultAmount.Text = "0";
                }
                if (string.IsNullOrEmpty(response.result.intervalDays.ToString()))
                {
                    intervalDays.Text = "0";
                }



                this.ScheduleBenefitWindow.Title = Resources.Common.EditWindowsTitle;
                this.ScheduleBenefitWindow.Show();
                break;

            case "imgDelete":
                X.Msg.Confirm(Resources.Common.Confirmation, Resources.Common.DeleteOneRecord, new MessageBoxButtonsConfig
                {
                    Yes = new MessageBoxButtonConfig
                    {
                        //We are call a direct request metho for deleting a record
                        Handler = String.Format("App.direct.DeleteScheduleBenefitRecord({0},{1})", benId, bsId.Text),
                        Text    = Resources.Common.Yes
                    },
                    No = new MessageBoxButtonConfig
                    {
                        Text = Resources.Common.No
                    }
                }).Show();
                break;

            case "imgAttach":

                //Here will show up a winow relatice to attachement depending on the case we are working on
                break;

            default:
                break;
            }
        }
コード例 #29
0
        protected void SaveNewRecord(object sender, DirectEventArgs e)
        {
            //Getting the id to check if it is an Add or an edit as they are managed within the same form.


            string          obj = e.ExtraParams["values"];
            PayrollArgument b   = JsonConvert.DeserializeObject <PayrollArgument>(obj);

            string id = e.ExtraParams["id"];

            // Define the object to add or edit as null

            if (string.IsNullOrEmpty(id))
            {
                try
                {
                    //New Mode
                    //Step 1 : Fill The object and insert in the store
                    PostRequest <PayrollArgument> request = new PostRequest <PayrollArgument>();

                    request.entity = b;
                    PostResponse <PayrollArgument> r = _payrollService.ChildAddOrUpdate <PayrollArgument>(request);


                    //check if the insert failed
                    if (!r.Success)//it maybe be another condition
                    {
                        //Show an error saving...
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        Common.errorMessage(r);
                        return;
                    }
                    else
                    {
                        b.recordId = r.recordId;
                        //Add this record to the store
                        Store1.Reload();

                        //Display successful notification
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordSavingSucc
                        });

                        this.EditRecordWindow.Close();
                    }
                }
                catch (Exception ex)
                {
                    //Error exception displaying a messsage box
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorSavingRecord).Show();
                }
            }
            else
            {
                //Update Mode

                try
                {
                    //getting the id of the record
                    PostRequest <PayrollArgument> request = new PostRequest <PayrollArgument>();
                    request.entity = b;
                    PostResponse <PayrollArgument> r = _payrollService.ChildAddOrUpdate <PayrollArgument>(request);                      //Step 1 Selecting the object or building up the object for update purpose

                    //Step 2 : saving to store

                    //Step 3 :  Check if request fails
                    if (!r.Success)//it maybe another check
                    {
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        Common.errorMessage(r);
                        return;
                    }
                    else
                    {
                        Store1.Reload();
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordUpdatedSucc
                        });
                        this.EditRecordWindow.Close();
                    }
                }
                catch (Exception ex)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
                }
            }
        }
コード例 #30
0
        protected void SaveNewRecord(object sender, DirectEventArgs e)
        {
            //Getting the id to check if it is an Add or an edit as they are managed within the same form.
            string id = e.ExtraParams["id"];

            string          obj  = e.ExtraParams["values"];
            string          addr = e.ExtraParams["address"];
            BusinessPartner b    = JsonConvert.DeserializeObject <BusinessPartner>(obj);


            b.recordId = id;
            // Define the object to add or edit as null



            // Define the object to add or edit as null
            CustomResolver res = new CustomResolver();

            res.AddRule("naId", "countryId");
            res.AddRule("stId", "stateId");
            JsonSerializerSettings settings = new JsonSerializerSettings();

            settings.ContractResolver = res;

            AddressBook add = JsonConvert.DeserializeObject <AddressBook>(addr, settings);

            if (string.IsNullOrEmpty(add.city) && string.IsNullOrEmpty(add.countryId) && string.IsNullOrEmpty(add.street1) && string.IsNullOrEmpty(add.stateId) && string.IsNullOrEmpty(add.phone))
            {
                b.address = null;
            }
            else
            {
                if (string.IsNullOrEmpty(add.city) || string.IsNullOrEmpty(add.countryId) || string.IsNullOrEmpty(add.street1) || string.IsNullOrEmpty(add.stateId) || string.IsNullOrEmpty(add.phone))
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, GetLocalResourceObject("ErrorAddressMissing")).Show();
                    return;
                }
                b.address          = JsonConvert.DeserializeObject <AddressBook>(addr, settings);
                b.address.recordId = address.Text;


                if (string.IsNullOrEmpty(id))
                {
                    try
                    {
                        //New Mode
                        //Step 1 : Fill The object and insert in the store
                        PostRequest <BusinessPartner> request = new PostRequest <BusinessPartner>();
                        request.entity = b;
                        PostResponse <BusinessPartner> r = _administrationService.ChildAddOrUpdate <BusinessPartner>(request);
                        b.recordId = r.recordId;

                        //check if the insert failed
                        if (!r.Success)//it maybe be another condition
                        {
                            //Show an error saving...
                            X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                            Common.errorMessage(r);;
                            return;
                        }
                        else
                        {
                            Notification.Show(new NotificationConfig
                            {
                                Title = Resources.Common.Notification,
                                Icon  = Icon.Information,
                                Html  = Resources.Common.RecordSavingSucc
                            });
                            //Add this record to the store


                            //Display successful notification

                            Store1.Reload();
                            EditRecordWindow.Close();
                        }
                    }
                    catch (Exception ex)
                    {
                        //Error exception displaying a messsage box
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorSavingRecord).Show();
                    }
                }
                else
                {
                    //Update Mode

                    try
                    {
                        PostRequest <BusinessPartner> request = new PostRequest <BusinessPartner>();

                        request.entity = b;
                        PostResponse <BusinessPartner> r = _administrationService.ChildAddOrUpdate <BusinessPartner>(request);                      //Step 1 Selecting the object or building up the object for update purpose

                        //Step 2 : saving to store

                        //Step 3 :  Check if request fails
                        if (!r.Success)//it maybe another check
                        {
                            X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                            Common.errorMessage(r);;
                            return;
                        }
                        else
                        {
                            ModelProxy record = this.Store1.GetById(id);

                            BasicInfoTab.UpdateRecord(record);

                            record.Commit();
                            Notification.Show(new NotificationConfig
                            {
                                Title = Resources.Common.Notification,
                                Icon  = Icon.Information,
                                Html  = Resources.Common.RecordUpdatedSucc
                            });

                            //    this.EditRecordWindow.Close();
                        }
                    }
                    catch (Exception ex)
                    {
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
                    }
                }
            }
        }