コード例 #1
0
        private void selectActionType(object sender, EventArgs e)
        {
            btnUpdate.Enabled        = true;
            btnAddActionType.Enabled = false;
            txtActionType.Enabled    = false;
            String            ActionTypeid = gridView1.GetFocusedDataRow()["Id"].ToString();
            ActionTypeService actionType   = new ActionTypeService();

            actionType.getActionTypeDetailsByID(ActionTypeid);

            txtActionType.Text = actionType.ActionType.ToString().Trim();

            int intDuration;

            intDuration = actionType.Duration;

            if (intDuration >= 24)
            {
                int days  = intDuration / 24;
                int Hours = intDuration % 24;

                txtDurationDays.Text  = days.ToString();
                txtDurationHours.Text = Hours.ToString();
            }
            else
            {
                txtDurationDays.Text  = "0";
                txtDurationHours.Text = actionType.Duration.ToString();
            }

            txtFirstReminder.Text = actionType.IntFirstReminder.ToString();
            txtEscaltion1.Text    = actionType.Intescaltion1.ToString();
            txtEscaltion2.Text    = actionType.Intescaltion2.ToString();

            tabActionType.SelectedTabPage = xtraTabPage2;
            xtraTabPage1.PageEnabled      = false;
            xtraTabPage2.PageEnabled      = true;
            xtraTabPage3.PageEnabled      = false;
        }
コード例 #2
0
        private void clearAll()
        {
            ActionTypeService actionType = new ActionTypeService();

            txtActionType.Text    = "";
            txtDurationDays.Text  = "";
            txtDurationHours.Text = "";
            //chkBxDateTimeMan.Checked = false;
            txtFirstReminder.Text = "";
            txtEscaltion1.Text    = "";
            txtEscaltion2.Text    = "";

            //cmbBxActionType.SelectedIndex = -1;
            txtActionTypeDesc.Text = "";
            //cmbBxCheckList.SelectedIndex = -1;
            txtActionTypeDesc.Text = "";
            //cmbBxCheckList.SelectedIndex = -1;
            txtCheckListDesc.Text = "";
            //txtCheckListDurationDays.Text = "";
            //txtCheckListDurationHours.Text = "";
            txtChecklistSeqNo.Text  = "";
            txtCheckListEscPer.Text = "";

            btnAddActionType.Text = "Add Action Type";
            btnAddCheckList.Text  = "Add Checklist";

            btnUpdate.Enabled = false;
            DataTable dt = actionType.getAllActionTypeDetails();

            gridActionType.DataSource = dt;
            //  tblActionTypeCheckList.DataSource = new DatabaseService().executeSelectQuery("SELECT ActionTypeID,ActionType,SubActionType,SeqNo FROM ActionTypeCheckList");
            tabActionType.SelectedTabPage = xtraTabPage1;
            xtraTabPage1.PageEnabled      = true;
            xtraTabPage2.PageEnabled      = false;
            xtraTabPage3.PageEnabled      = false;
        }
コード例 #3
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";
                        }
                    }
                }
            }
        }
コード例 #4
0
        public IEnumerable <ServiceAction> GetActions(Int64 user_id, DateTime dateBegin, DateTime dateEnd)
        {
            var date1 = new DateTime(dateBegin.Year, dateBegin.Month, dateBegin.Day, 0, 0, 0);
            var date2 = new DateTime(dateEnd.Year, dateEnd.Month, dateEnd.Day, 23, 59, 59);

            var actions = new List <ServiceAction>();

            SqlConnection connection = SqlProvider.CreateConnection();
            SqlCommand    cmd        = null;
            SqlDataReader reader     = null;

            try {
                cmd = connection.CreateCommand();

                cmd.CommandText = @"
                    select a.id, a.dt, a.customer, a.service_id, a.type_id, a.user_id, s.org_id, a.customer_type_id
                        from Actions a
                        join Services s on s.id = a.service_id
                    where a.dt between @date1 and @date2
                        and a.is_deleted = 0 ";


                cmd.Parameters.AddWithValue("date1", date1);
                cmd.Parameters.AddWithValue("date2", date2);

                if (user_id >= 0)
                {
                    cmd.CommandText += " and a.user_id = @user_id";
                    cmd.Parameters.AddWithValue("user_id", user_id);
                }

                cmd.CommandText += " order by a.dt desc, a.id desc";


                reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    actions.Add(new ServiceAction {
                        Id           = Convert.ToInt64(reader["id"]),
                        Service      = ServiceService.GetServiceById(Convert.ToInt64(reader["service_id"])),
                        User         = UserService.GetUserById(Convert.ToInt64(reader["user_id"])),
                        Date         = Convert.ToDateTime(reader["dt"]),
                        Type         = ActionTypeService.GetTypeById(Convert.ToInt64(reader["type_id"])),
                        Customer     = reader["customer"] != DBNull.Value ? Convert.ToString(reader["customer"]) : string.Empty,
                        CustomerType = reader["customer_type_id"] != DBNull.Value ? CustomerTypeService.GetTypeById(Convert.ToInt64(reader["customer_type_id"])) : CustomerType.Empty
                    });
                }
            }
            catch (Exception e) {
                Logger.Error(e);
                throw;
            }
            finally {
                if (reader != null)
                {
                    reader.Close();
                    reader.Dispose();
                }

                if (cmd != null)
                {
                    cmd.Dispose();
                }
                connection.Close();
            }

            return(actions);
        }