コード例 #1
0
        private void btnAddActionType_Click(object sender, EventArgs e)
        {
            if (InfoPCMS.user.checkFunctionAuthentication("77"))
            {
                if (btnAddActionType.Text == "Add Action Type")
                {
                    btnAddActionType.Text         = "Save";
                    tabActionType.SelectedTabPage = xtraTabPage2;
                    xtraTabPage1.PageEnabled      = false;
                    xtraTabPage2.PageEnabled      = true;
                    xtraTabPage3.PageEnabled      = false;
                }
                else if (btnAddActionType.Text == "Save")
                {
                    ActionTypeService actionType = new ActionTypeService();
                    if (string.IsNullOrEmpty(txtDurationDays.Text.ToString()))
                    {
                        txtDurationDays.Text = "0";
                    }
                    if (string.IsNullOrEmpty(txtDurationHours.Text.ToString()))
                    {
                        txtDurationHours.Text = "0";
                    }

                    if (this.ValidationActionType())
                    {
                        XtraMessageBox.Show(InfoPCMS.message.GET_EMPTY_FIELDS_ERROR(), "Error");
                    }
                    else
                    {
                        int intDurations = (Convert.ToInt32(txtDurationDays.Text.ToString()) * 24 + Convert.ToInt32(txtDurationHours.Text.ToString()));

                        actionType.ActionType       = txtActionType.Text.Trim();
                        actionType.Duration         = intDurations;
                        actionType.IntFirstReminder = Convert.ToInt32(txtFirstReminder.Text.ToString().Trim());
                        actionType.Intescaltion1    = Convert.ToInt32(txtEscaltion1.Text.ToString().Trim());
                        actionType.Intescaltion2    = Convert.ToInt32(txtEscaltion2.Text.ToString().Trim());
                        //actionType.IsDateTimeMandatory = Convert.ToString(chkBxDateTimeMan.Checked);

                        Boolean result = actionType.addActionType();

                        if (result)
                        {
                            //DataTable dt = InfoPCMS.db.executeSelectQuery(String.Format("select * from ActionType where ActionType='{0}' ", txtActionType.Text));
                            //if (dt.Rows.Count > 0)
                            //{
                            //    new DatabaseService().executeUpdateQuery(String.Format("INSERT INTO CustomerLocation VALUES('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}')", dt.Rows[0]["Id"], dt.Rows[0]["CustomerName"], dt.Rows[0]["NbtChargeble"], dt.Rows[0]["NbtChargeble"], dt.Rows[0]["ContactNumber"], dt.Rows[0]["Address"], dt.Rows[0]["Company"], dt.Rows[0]["Designation"], dt.Rows[0]["Faxno"], dt.Rows[0]["Email"], dt.Rows[0]["ServiceCenter"], dt.Rows[0]["DistancetoServiceCenter"], dt.Rows[0]["DistanceFromColombo"], dt.Rows[0]["HiltopSite"], dt.Rows[0]["NonMotorable"]));
                            //}
                            clearAll();

                            XtraMessageBox.Show(InfoPCMS.message.GET_RECORD_ADDED_INFORMATION(), "Information");

                            //txtActionTypeDesc.Text  ""
                            // cmbBxCheckList.DataSource = null;

                            // DataTable dt2 = InfoPCMS.db.executeSelectQuery("select * from ActionType");
                            // dt.Columns.Add("ConcatenatedField", typeof(string), "CustomerName + ' : ' + Address");

                            //cmbBxActionType.DataSource = dt2;
                            //cmbBxActionType.ValueMember = "ActionType";
                            //cmbBxActionType.DisplayMember = "ActionType";

                            //cmbBxCheckList.DataSource = dt2;
                            //cmbBxCheckList.ValueMember = "ActionType";
                            // cmbBxCheckList.DisplayMember = "ActionType";
                        }
                    }
                }
            }
        }