public Models.OpexStaffExpDiffModel GetOpexStaffExpDiffMtd(int id)
        {
            // List<int> IDs_of_currentSubCaptions = (List<int>)System.Web.HttpContext.Current.Session["IDs_of_currentSubCaptionsOtherInfo"];
            //List<int> IDs_of_currentSubCaptions = (List<int>)System.Web.HttpContext.Current.Session["IDs_of_currentSubCaptionsOtherInfo"];
            List <OpexStaffExpDiffModel> op = (List <OpexStaffExpDiffModel>)System.Web.HttpContext.Current.Session["opexstaffexpdiff"];

            OpexStaffExpDiffModel opObj = op.Where(x => x.ID == id).FirstOrDefault();

            return(opObj);
        }
Пример #2
0
        public HttpResponseMessage GetOpexRawExpense(HttpRequestMessage request, int id)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage res = null;

                //OpexStaffExpDiffModel opobj = new OpexStaffExpDiffModel();
                OpexMtd obj = new OpexMtd();

                OpexStaffExpDiffModel opObj = obj.GetOpexStaffExpDiffMtd(id);

                res = request.CreateResponse(HttpStatusCode.OK, opObj);

                return res;
            }));
        }
        public IEnumerable <Models.OpexStaffExpDiffModel> GetTopOpexStaffExpDiffMtd()
        {
            List <OpexStaffExpDiffModel> opexstaffexpdiffList = new List <OpexStaffExpDiffModel>();

            using (var con = new System.Data.SqlClient.SqlConnection(connectionString))
            {
                var cmd = new System.Data.SqlClient.SqlCommand("spp_proc_ExpenseGLR", con);
                cmd.CommandType    = System.Data.CommandType.StoredProcedure;
                cmd.CommandTimeout = 0;

                con.Open();

                SqlDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    var op = new OpexStaffExpDiffModel();

                    //op.OPEX_STAFFEXP_DIFF_Id = reader["OPEX_STAFFEXP_DIFF_Id"] != DBNull.Value ? int.Parse(reader["OPEX_STAFFEXP_DIFF_Id"].ToString()) : 0;
                    //op.Salary_BranchCode = reader["Salary_BranchCode"] != DBNull.Value ? reader["Salary_BranchCode"].ToString() : "default";
                    //op.RawExpense_BranchCode = reader["RawExpense_BranchCode"] != DBNull.Value ? reader["RawExpense_BranchCode"].ToString() : "default";
                    //op.SalaryAMount = reader["SalaryAMount"] != DBNull.Value ? double.Parse(reader["SalaryAMount"].ToString()) : 0;
                    //op.RawExpenseAmount = reader["RawExpenseAmount"] != DBNull.Value ? double.Parse(reader["RawExpenseAmount"].ToString()) : 0;
                    //op.Differences = reader["Differences"] != DBNull.Value ? double.Parse(reader["Differences"].ToString()) : 0;

                    op.ID             = reader["ID"] != DBNull.Value ? int.Parse(reader["ID"].ToString()) : 0;
                    op.GL_Code        = reader["GL_Code"] != DBNull.Value ? reader["GL_Code"].ToString() : "null";
                    op.GL_Description = reader["GL_Description"] != DBNull.Value ? reader["GL_Description"].ToString() : "null";
                    op.FinstatAmount  = reader["FinstatAmount"] != DBNull.Value ? double.Parse(reader["FinstatAmount"].ToString()) : 0;
                    op.OpexAmount     = reader["OpexAmount"] != DBNull.Value ? double.Parse(reader["OpexAmount"].ToString()) : 0;
                    op.Difference     = reader["Difference"] != DBNull.Value ? double.Parse(reader["Difference"].ToString()) : 0;


                    opexstaffexpdiffList.Add(op);
                }
                con.Close();
                System.Web.HttpContext.Current.Session["opexstaffexpdiff"] = opexstaffexpdiffList;
            }
            return(opexstaffexpdiffList);
        } //========== end of the mtd